model

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AllocationStatusPending status is pending
	AllocationStatusPending = "Pending"
	// AllocationStatusRegistered status is registered
	AllocationStatusRegistered = "Registered"
	// AllocationStatusError status is error
	AllocationStatusError = "Error"
	// AllocationStatusDeleting indicates that the allocation is being deleted
	AllocationStatusDeleting = "Deleting"
	// AllocationRelationName is the relation name for the Allocation model
	AllocationRelationName = "Allocation"

	// AllocationOrderByDefault default field to be used for ordering when none specified
	AllocationOrderByDefault = allocationOrderByCreated
)
View Source
const (
	// AllocationConstraintTypeReserved indicates that the resources are reserved
	AllocationConstraintTypeReserved = "Reserved"
	// AllocationConstraintTypeOnDemand indicates that the resources are on-demand
	AllocationConstraintTypeOnDemand = "OnDemand"
	// AllocationConstraintTypePreemptible indicates that the resources are preemptible
	AllocationConstraintTypePreemptible = "Preemptible"

	// AllocationResourceTypeInstanceType indicates that the constraint is for an Instance Type
	AllocationResourceTypeInstanceType = "InstanceType"
	// AllocationResourceTypeIPBlock indicates that the constraint is for an IP Block
	AllocationResourceTypeIPBlock = "IPBlock"
	// AllocationConstraintRelationName is the relation name for the Allocation Constraint model
	AllocationConstraintRelationName = "AllocationConstraint"

	// AllocationConstraintOrderByDefault default field to be used for ordering when none specified
	AllocationConstraintOrderByDefault = "created"
)
View Source
const (
	// DomainStatusPending status is pending
	DomainStatusPending = "DomainStatusPending"
	// DomainStatusRegistering status is registering
	DomainStatusRegistering = "DomainStatusRegistering"
	// DomainStatusReady status is ready
	DomainStatusReady = "DomainStatusReady"
	// DomainStatusError status is error
	DomainStatusError = "DomainStatusError"
	// DomainRelationName is the relation name for the Domain model
	DomainRelationName = "Domain"
)
View Source
const (
	// DpuExtensionServiceTimeFormat is the time format used on Site for version info creation time
	DpuExtensionServiceTimeFormat = "2006-01-02 15:04:05.000000 UTC"

	// FabricRelationName is the relation name for the Fabric model
	DpuExtensionServiceRelationName = "DpuExtensionService"
)
View Source
const (
	// DpuExtensionServiceStatusPending indicates that the DpuExtensionService request was received but not yet processed
	DpuExtensionServiceStatusPending = "Pending"
	// DpuExtensionServiceStatusReady indicates that the DpuExtensionService is ready on the Site
	DpuExtensionServiceStatusReady = "Ready"
	// DpuExtensionServiceStatusError is the status of a DpuExtensionService that is in error mode
	DpuExtensionServiceStatusError = "Error"
	// DpuExtensionServiceStatusDeleting indicates that the DpuExtensionService is being deleted
	DpuExtensionServiceStatusDeleting = "Deleting"

	// DpuExtensionServiceOrderByDefault default field to be used for ordering when none specified
	DpuExtensionServiceOrderByDefault = "created"
)
View Source
const (
	// DpuExtensionServiceDeploymentStatusPending indicates that the DpuExtensionServiceDeployment request was received but not yet processed
	DpuExtensionServiceDeploymentStatusPending = "Pending"
	// DpuExtensionServiceDeploymentStatusRunning indicates that the DpuExtensionServiceDeployment is running on the Site
	DpuExtensionServiceDeploymentStatusRunning = "Running"
	// DpuExtensionServiceDeploymentStatusError is the status of a DpuExtensionServiceDeployment that is in error mode
	DpuExtensionServiceDeploymentStatusError = "Error"
	// DpuExtensionServiceDeploymentStatusFailed indicates that the DpuExtensionServiceDeployment has failed
	DpuExtensionServiceDeploymentStatusFailed = "Failed"
	// DpuExtensionServiceDeploymentStatusTerminating indicates that the DpuExtensionServiceDeployment is being terminated
	DpuExtensionServiceDeploymentStatusTerminating = "Terminating"

	// DpuExtensionServiceDeploymentOrderByDefault default field to be used for ordering when none specified
	DpuExtensionServiceDeploymentOrderByDefault = "created"
)
View Source
const (
	// FabricStatusPending indicates that the Fabric request was received but not yet processed
	FabricStatusPending = "Pending"
	// FabricStatusReady indicates that the Fabric is ready on the Site
	FabricStatusReady = "Ready"
	// FabricStatusError is the status of a Fabric that is in error mode
	FabricStatusError = "Error"
	// FabricStatusDeleting indicates that the Fabric is being deleted
	FabricStatusDeleting = "Deleting"

	// FabricOrderByDefault default field to be used for ordering when none specified
	FabricOrderByDefault = "created"
)
View Source
const (
	// InfiniBandInterfaceStatusPending indicates that the InfiniBandInterface request was received but not yet processed
	InfiniBandInterfaceStatusPending = "Pending"
	// InfiniBandInterfaceStatusProvisioning indicates that the InfiniBandInterface is being provisioned
	InfiniBandInterfaceStatusProvisioning = "Provisioning"
	// InfiniBandInterfaceStatusReady indicates that the InfiniBandInterface has been successfully provisioned on the Site
	InfiniBandInterfaceStatusReady = "Ready"
	// InfiniBandInterfaceStatusError is the status of a InfiniBandInterface that is in error mode
	InfiniBandInterfaceStatusError = "Error"
	// InfiniBandInterfaceStatusDeleting is the status of a InfiniBandInterface that is in deleting mode
	InfiniBandInterfaceStatusDeleting = "Deleting"
	// InfiniBandInterfaceRelationName is the relation name for the InfiniBandInterface model
	InfiniBandInterfaceRelationName = "InfiniBandInterface"

	// InfiniBandInterfaceOrderByStatus field to be used for ordering when none specified
	InfiniBandInterfaceOrderByStatus = "status"
	// InfiniBandInterfaceOrderByCreated field to be used for ordering when none specified
	InfiniBandInterfaceOrderByCreated = "created"
	// InfiniBandInterfaceOrderByUpdated field to be used for ordering when none specified
	InfiniBandInterfaceOrderByUpdated = "updated"

	// InfiniBandInterfaceOrderByDefault default field to be used for ordering when none specified
	InfiniBandInterfaceOrderByDefault = InfiniBandInterfaceOrderByCreated
)
View Source
const (
	// InfiniBandPartitionStatusPending indicates that the InfiniBandPartition request was received but not yet processed
	InfiniBandPartitionStatusPending = "Pending"
	// InfiniBandPartitionStatusProvisioning indicates that the InfiniBandPartition is being provisioned
	InfiniBandPartitionStatusProvisioning = "Provisioning"
	// InfiniBandPartitionStatusReady indicates that the InfiniBandPartition has been successfully provisioned on the Site
	InfiniBandPartitionStatusReady = "Ready"
	// InfiniBandPartitionStatusConfiguring indicates that the InfiniBandPartition is being configuring
	InfiniBandPartitionStatusConfiguring = "Configuring"
	// InfiniBandPartitionStatusError is the status of a InfiniBandPartition that is in error mode
	InfiniBandPartitionStatusError = "Error"
	// InfiniBandPartitionStatusDeleting indicates that the InfiniBandPartition is being deleted
	InfiniBandPartitionStatusDeleting = "Deleting"
	// InfiniBandPartitionRelationName is the relation name for the InfiniBandPartition model
	InfiniBandPartitionRelationName = "InfiniBandPartition"

	// InfiniBandPartitionOrderByDefault default field to be used for ordering when none specified
	InfiniBandPartitionOrderByDefault = "created"
)
View Source
const (
	// InstanceStatusPending indicates that the Instance provisioning hasn't started yet
	InstanceStatusPending = "Pending"
	// InstanceStatusProvisioning indicates that the Instance provisioning is in progress
	InstanceStatusProvisioning = "Provisioning"
	// InstanceStatusConfiguring indicates that the Instance is being configured
	InstanceStatusConfiguring = "Configuring"
	// InstanceStatusReady indicates that the Instance provisioning is complete
	InstanceStatusReady = "Ready"
	// InstanceStatusUpdating indicates that the Instance is receiving system updates
	InstanceStatusUpdating = "Updating"
	// InstanceStatusRepairing indicates the Instance is under in-pool online repair
	InstanceStatusRepairing = "Repairing"
	// InstanceStatusError indicates that the Instance provisioning has failed
	InstanceStatusError = "Error"
	// InstanceStatusTerminating indicates that the Instance is being terminated
	InstanceStatusTerminating = "Terminating"
	// InstanceStatusTerminated indicates that the Instance has been terminated
	InstanceStatusTerminated = "Terminated"
	// InstanceStatusUnknown indicates that the Instance status is unknown
	InstanceStatusUnknown = "Unknown"

	// InstancePowerStatusBootCompleted status is bootcompleted
	InstancePowerStatusBootCompleted = "BootCompleted"
	// InstancePowerStatusRebooting status is rebooting
	InstancePowerStatusRebooting = "Rebooting"
	// InstancePowerStatusError status is error
	InstancePowerStatusError = "Error"

	// InstanceRelationName is the relation name for the Instance model
	InstanceRelationName = "Instance"

	// InstanceOrderByDefault default field to be used for ordering when none specified
	InstanceOrderByDefault = instanceOrderByCreated
)
View Source
const (
	// InstanceTypeStatusPending status is pending
	InstanceTypeStatusPending = "Pending"
	// InstanceTypeStatusRegistering status is registering
	InstanceTypeStatusRegistering = "Registering"
	// InstanceTypeStatusReady status is ready
	InstanceTypeStatusReady = "Ready"
	// InstanceTypeStatusError status is error
	InstanceTypeStatusError = "Error"
	// InstanceTypeStatusDeleting indicates that the record is being deleted
	InstanceTypeStatusDeleting = "Deleting"
	// InstanceTypeRelationName is the relation name for the InstanceType model
	InstanceTypeRelationName = "InstanceType"

	// InstanceTypeOrderByDefault default field to be used for ordering when none specified
	InstanceTypeOrderByDefault = "created"
)
View Source
const (
	// InterfaceStatusPending status is pending
	InterfaceStatusPending = "Pending"
	// InterfaceStatusProvisioning status is provisioning
	InterfaceStatusProvisioning = "Provisioning"
	// InterfaceStatusReady status is ready
	InterfaceStatusReady = "Ready"
	// InterfaceStatusError status is error
	InterfaceStatusError = "Error"
	// InterfaceStatusDeleting status is deleting
	InterfaceStatusDeleting = "Deleting"
	// InterfaceRelationName is the relation name for the Interface model
	InterfaceRelationName = "Interface"

	// InterfaceOrderByStatus field to be used for ordering by status
	InterfaceOrderByStatus = "status"
	// InterfaceOrderByCreated field to be used for ordering by created
	InterfaceOrderByCreated = "created"
	// InterfaceOrderByUpdated field to be used for ordering by updated
	InterfaceOrderByUpdated = "updated"

	// InterfaceOrderByDefault default field to be used for ordering when none specified
	InterfaceOrderByDefault = InterfaceOrderByCreated
)
View Source
const (
	// IPBlockStatusPending status is pending
	IPBlockStatusPending = "Pending"
	// IPBlockStatusProvisioning status is provisioning
	IPBlockStatusProvisioning = "Provisioning"
	// IPBlockStatusReady status is ready
	IPBlockStatusReady = "Ready"
	// IPBlockStatusError status is error
	IPBlockStatusError = "Error"
	// IPBlockStatusDeleting indicates that the IPBlock is being deleted
	IPBlockStatusDeleting = "Deleting"

	// IPBlockRoutingTypePublic routing type is Public
	IPBlockRoutingTypePublic = "Public"
	// IPBlockRoutingTypeDatacenterOnly routing type is DatacenterOnly
	IPBlockRoutingTypeDatacenterOnly = "DatacenterOnly"

	// IPBlockProtocolVersionV4 protocol version is ipv4
	IPBlockProtocolVersionV4 = "IPv4"
	// IPBlockProtocolVersionV6 protocol version is ipv6
	IPBlockProtocolVersionV6 = "IPv6"
	// IPBlockRelationName is the relation name for the IPBlock model
	IPBlockRelationName = "IPBlock"
	// IPv4BlockRelationName is the relation name for the IPBlock model
	IPv4BlockRelationName = "IPv4Block"
	// IPv6BlockRelationName is the relation name for the IPBlock model
	IPv6BlockRelationName = "IPv6Block"

	// IPBlockOrderByDefault default field to be used for ordering when none specified
	IPBlockOrderByDefault = "created"
)
View Source
const (
	// MachineStatusInitializing indicates that the Machine is Initializing
	MachineStatusInitializing = "Initializing"
	// MachineStatusReady indicates that the Machine is ready
	MachineStatusReady = "Ready"
	// MachineStatusReset indicates that the Machine is being reset
	MachineStatusReset = "Reset"
	// MachineStatusMaintenance indicates that the Machine is in maintenance mode
	MachineStatusMaintenance = "Maintenance"
	// MachineStatusInUse indicates that the Machine is being used by an Instance
	MachineStatusInUse = "InUse"
	// MachineStatusError indicates that the Machine is in error state
	MachineStatusError = "Error"
	// MachineStatusDecommissioned indicates that the Machine was decommissioned
	MachineStatusDecommissioned = "Decommissioned"
	// MachineStatusUnknown indicates that the Machine status cannot be determined
	MachineStatusUnknown = "Unknown"
	// MachineRelationName is the relation name for the Machine model
	MachineRelationName = "Machine"

	// MachineOrderByDefault default field to be used for ordering when none specified
	MachineOrderByDefault = "created"
)

Represents status of the machine

View Source
const (
	MachineCapabilityTypeCPU           = "CPU"
	MachineCapabilityTypeMemory        = "Memory"
	MachineCapabilityTypeGPU           = "GPU"
	MachineCapabilityTypeStorage       = "Storage"
	MachineCapabilityTypeNetwork       = "Network"
	MachineCapabilityTypeInfiniBand    = "InfiniBand"
	MachineCapabilityTypeDPU           = "DPU"
	MachineCapabilityDeviceTypeDPU     = "DPU"
	MachineCapabilityDeviceTypeNVLink  = "NVLink"
	MachineCapabilityDeviceTypeUnknown = "Unknown"

	// MachineCapabilityRelationName is the relation name for the MachineCapability model
	MachineCapabilityRelationName = "MachineCapability"

	// MachineCapabilityOrderByDefault default field to be used for ordering when none specified
	MachineCapabilityOrderByDefault = "created"
)

MachineCapabilityType

View Source
const (
	// MachineInstanceTypeRelationName is the relation name for the MachineInstanceType model
	MachineInstanceTypeRelationName = "MachineInstanceType"

	// MachineInstanceTypeOrderByDefault default field to be used for ordering when none specified
	MachineInstanceTypeOrderByDefault = "created"
)
View Source
const (
	// MachineInterfaceRelationName is the relation name for the MachineInterface model
	MachineInterfaceRelationName = "MachineInterface"

	// MachineInterfaceOrderByDefault default field to be used for ordering when none specified
	MachineInterfaceOrderByDefault = "created"
)
View Source
const (
	// NetworkSecurityGroupStatusPending status is pending
	NetworkSecurityGroupStatusPending = "Pending"
	// NetworkSecurityGroupStatusProvisioning status is provisioning
	NetworkSecurityGroupStatusProvisioning = "Provisioning"
	// NetworkSecurityGroupStatusReady status is ready
	NetworkSecurityGroupStatusReady = "Ready"
	// NetworkSecurityGroupStatusDeleting indicates that the security group is being deleted
	NetworkSecurityGroupStatusDeleting = "Deleting"
	// NetworkSecurityGroupStatusError status is error
	NetworkSecurityGroupStatusError = "Error"
	// NetworkSecurityGroupRelationName is the relation name for the NetworkSecurityGroup model
	NetworkSecurityGroupRelationName = "NetworkSecurityGroup"

	// NetworkSecurityGroupOrderByDefault default field to be used for ordering when none specified
	NetworkSecurityGroupOrderByDefault = "created"
)
View Source
const (
	// NVLinkInterfaceStatusPending indicates that the NVLinkInterface request was received but not yet processed
	NVLinkInterfaceStatusPending = "Pending"
	// NVLinkInterfaceStatusProvisioning indicates that the NVLinkInterface is being provisioned
	NVLinkInterfaceStatusProvisioning = "Provisioning"
	// NVLinkInterfaceStatusReady indicates that the NVLinkInterface has been successfully provisioned on the Site
	NVLinkInterfaceStatusReady = "Ready"
	// NVLinkInterfaceStatusError is the status of a NVLinkInterface that is in error mode
	NVLinkInterfaceStatusError = "Error"
	// NVLinkInterfaceStatusDeleting is the status of a NVLinkInterface that is in deleting mode
	NVLinkInterfaceStatusDeleting = "Deleting"
	// NVLinkInterfaceRelationName is the relation name for the NVLinkInterface model
	NVLinkInterfaceRelationName = "NVLinkInterface"

	// NVLinkInterfaceOrderByStatus field to be used for ordering when none specified
	NVLinkInterfaceOrderByStatus = "status"
	// NVLinkInterfaceOrderByCreated field to be used for ordering when none specified
	NVLinkInterfaceOrderByCreated = "created"
	// NVLinkInterfaceOrderByUpdated field to be used for ordering when none specified
	NVLinkInterfaceOrderByUpdated = "updated"

	// NVLinkInterfaceOrderByDefault default field to be used for ordering when none specified
	NVLinkInterfaceOrderByDefault = NVLinkInterfaceOrderByCreated
)
View Source
const (
	// NVLinkLogicalPartitionStatusPending indicates that the NVLinkLogicalPartition request was received but not yet processed
	NVLinkLogicalPartitionStatusPending = "Pending"
	// NVLinkLogicalPartitionStatusProvisioning indicates that the NVLinkLogicalPartition is being provisioned
	NVLinkLogicalPartitionStatusProvisioning = "Provisioning"
	// NVLinkLogicalPartitionStatusReady indicates that the NVLinkLogicalPartition has been successfully provisioned on the Site
	NVLinkLogicalPartitionStatusReady = "Ready"
	// NVLinkLogicalPartitionStatusConfiguring indicates that the NVLinkLogicalPartition is being configuring
	NVLinkLogicalPartitionStatusConfiguring = "Configuring"
	// NVLinkLogicalPartitionStatusError is the status of a NVLinkLogicalPartition that is in error mode
	NVLinkLogicalPartitionStatusError = "Error"
	// NVLinkLogicalPartitionStatusDeleting indicates that the NVLinkLogicalPartition is being deleted
	NVLinkLogicalPartitionStatusDeleting = "Deleting"
	// NVLinkLogicalPartitionRelationName is the relation name for the NVLinkLogicalPartition model
	NVLinkLogicalPartitionRelationName = "NVLinkLogicalPartition"

	// NVLinkLogicalPartitionOrderByDefault default field to be used for ordering when none specified
	NVLinkLogicalPartitionOrderByDefault = "created"
)
View Source
const (
	// OperatingSystemStatusPending status is pending
	OperatingSystemStatusPending = "Pending"
	// OperatingSystemStatusProvisioning status is provisioning
	OperatingSystemStatusProvisioning = "Provisioning"
	// OperatingSystemStatusReady status is ready
	OperatingSystemStatusReady = "Ready"
	// OperatingSystemStatusError status is error
	OperatingSystemStatusError = "Error"
	// OperatingSystemStatusDeleting indicates that the record is being deleted
	OperatingSystemStatusDeleting = "Deleting"
	// OperatingSystemStatusSyncing status is syncing
	OperatingSystemStatusSyncing = "Syncing"
	// OperatingSystemStatusDeactivated status is deactivated
	OperatingSystemStatusDeactivated = "Deactivated"

	// OperatingSystemRelationName is the relation name for the OperatingSystem model
	OperatingSystemRelationName = "OperatingSystem"
	// OperatingSystemTypeIPXE is the ipxe based OperatingSystem type
	OperatingSystemTypeIPXE = "iPXE"
	// OperatingSystemTypeImage is the image based OperatingSystem type
	OperatingSystemTypeImage = "Image"

	// OperatingSystemOrderByDefault default field to be used for ordering when none specified
	OperatingSystemOrderByDefault = "created"

	// OperatingSystemAuthTypeBasic is the basic image auth type
	OperatingSystemAuthTypeBasic = "Basic"
	// OperatingSystemAuthTypeBearer is the bearer image auth type
	OperatingSystemAuthTypeBearer = "Bearer"
)
View Source
const (
	// OperatingSystemSiteAssociationStatusSyncing status is syncing
	OperatingSystemSiteAssociationStatusSyncing = "Syncing"
	// OperatingSystemSiteAssociationStatusSynced status is synced
	OperatingSystemSiteAssociationStatusSynced = "Synced"
	// OperatingSystemSiteAssociationStatusError status is error
	OperatingSystemSiteAssociationStatusError = "Error"
	// OperatingSystemSiteAssociationStatusDeleting status is deleting
	OperatingSystemSiteAssociationStatusDeleting = "Deleting"

	// OperatingSystemSiteAssociationOrderByDefault default field to be used for ordering when none specified
	OperatingSystemSiteAssociationOrderByDefault = "created"
)
View Source
const (
	// SiteStatusPending indicates that the site registration is pending
	SiteStatusPending = "Pending"
	// SiteStatusRegistered indicates that the site has been registered
	SiteStatusRegistered = "Registered"
	// SiteStatusError indicates that the site registration encountered errors
	SiteStatusError = "Error"

	// SiteRelationName is the relation name for the Site model
	SiteRelationName = "Site"

	// SiteOrderByDefault default field to be used for ordering when none specified
	SiteOrderByDefault = "created"
)
View Source
const (
	// SkuRelationName is the relation name for the Sku model
	SkuRelationName = "Sku"
	// names of order by fields
	SkuOrderByCreated = "created"

	// SkuOrderByDefault default field to be used for ordering when none specified
	SkuOrderByDefault = SkuOrderByCreated
)
View Source
const (
	// SSHKeyRelationName is the relation name for the SSHKey model
	SSHKeyRelationName = "SSHKey"

	// SSHKeyOrderByDefault default field to be used for ordering when none specified
	SSHKeyOrderByDefault = "created"
)
View Source
const (
	// SSHKeyGroupStatus status is syncing
	SSHKeyGroupStatusSyncing = "Syncing"
	// SSHKeyGroupStatusSynced status is synced
	SSHKeyGroupStatusSynced = "Synced"
	// SSHKeyGroupStatusError status is error
	SSHKeyGroupStatusError = "Error"
	// SSHKeyGroupStatusDeleting status is deleting
	SSHKeyGroupStatusDeleting = "Deleting"

	// SSHKeyGroupOrderByDefault default field to be used for ordering when none specified
	SSHKeyGroupOrderByDefault = "created"
)
View Source
const (
	// SSHKeyGroupSiteAssociationStatusSyncing status is syncing
	SSHKeyGroupSiteAssociationStatusSyncing = "Syncing"
	// SSHKeyGroupSiteAssociationStatusSynced status is synced
	SSHKeyGroupSiteAssociationStatusSynced = "Synced"
	// SSHKeyGroupSiteAssociationStatusError status is error
	SSHKeyGroupSiteAssociationStatusError = "Error"
	// SSHKeyGroupSiteAssociationStatusDeleting status is deleting
	SSHKeyGroupSiteAssociationStatusDeleting = "Deleting"

	// SSHKeyGroupSiteAssociationOrderByDefault default field to be used for ordering when none specified
	SSHKeyGroupSiteAssociationOrderByDefault = "created"
)
View Source
const (
	// SubnetStatusPending status is pending
	SubnetStatusPending = "Pending"
	// SubnetStatusProvisioning status is provisioning
	SubnetStatusProvisioning = "Provisioning"
	// SubnetStatusReady status is ready
	SubnetStatusReady = "Ready"
	// SubnetStatusError status is error
	SubnetStatusError = "Error"
	// SubnetStatusDeleting indicates that the subnet is being deleted
	SubnetStatusDeleting = "Deleting"
	// SubnetStatusDeleted indicates that the subnet has been deleted
	SubnetStatusDeleted = "Deleted"
	// SubnetStatusUnknown indicates that the subnet status is unknown
	SubnetStatusUnknown = "Unknown"

	// SubnetRelationName is the relation name for the Subnet model
	SubnetRelationName = "Subnet"

	// SubnetOrderByDefault default field to be used for ordering when none specified
	SubnetOrderByDefault = "created"
)
View Source
const (
	// TenantAccountStatusPending status is pending
	TenantAccountStatusPending = "Pending"
	// TenantAccountStatusInvited status is invited
	TenantAccountStatusInvited = "Invited"
	// TenantAccountStatusReady status is ready
	TenantAccountStatusReady = "Ready"
	// TenantAccountStatusError status is error
	TenantAccountStatusError = "Error"
	// TenantAccountRelationName is the relation name for the TenantAccount model
	TenantAccountRelationName = "TenantAccount"
	TenantContactRelationName = "TenantContact"

	// TenantAccountOrderByDefault default field to be used for ordering when none specified
	TenantAccountOrderByDefault = tenantAccountOrderByCreated
)
View Source
const (
	// UserRelationName is the relation name for the User model
	UserRelationName = "User"

	// UserOrderByDefault default field to be used for ordering when none specified
	UserOrderByDefault = "created"
)
View Source
const (
	// VpcStatusPending indicates that the VPC request was received but not yet processed
	VpcStatusPending = "Pending"
	// VpcStatusProvisioning indicates that the VPC is being provisioned
	VpcStatusProvisioning = "Provisioning"
	// VpcStatusReady indicates that the VPC has been successfully provisioned on the Site
	VpcStatusReady = "Ready"
	// VpcStatusError is the status of a Vpc that is in error mode
	VpcStatusError = "Error"
	// VpcStatusDeleting indicates that the VPC is being deleted
	VpcStatusDeleting = "Deleting"
	// VpcRelationName is the relation name for the Vpc model
	VpcRelationName = "Vpc"

	// VpcOrderByDefault default field to be used for ordering when none specified
	VpcOrderByDefault = "created"

	// VpcEthernetVirtualizer is basic nico native netorking
	VpcEthernetVirtualizer         = "ETHERNET_VIRTUALIZER"
	VpcEthernetVirtualizerWithNVUE = "ETHERNET_VIRTUALIZER_WITH_NVUE"
	VpcFNNClassic                  = "FNN_CLASSIC"
	VpcFNNL3                       = "FNN_L3"
	VpcFNN                         = "FNN"
)
View Source
const (
	// VpcPeering status is pending
	VpcPeeringStatusPending = "Pending"
	// VpcPeering status is configuring
	VpcPeeringStatusConfiguring = "Configuring"
	// VpcPeering status is requested, the requester has issued request to the owner of the peer VPC
	VpcPeeringStatusRequested = "Requested"
	// VpcPeering status is ready
	VpcPeeringStatusReady = "Ready"
	// VpcPeering status is deleting
	VpcPeeringStatusDeleting = "Deleting"
	// VpcPeering status is error
	VpcPeeringStatusError = "Error"

	// VpcPeeringRelationName is the relation name for the VpcPeering model
	VpcPeeringRelationName = "VpcPeering"
	// Vpc1RelationName is the relation name for Vpc1 field in VpcPeering
	Vpc1RelationName = "Vpc1"
	// Vpc2RelationName is the relation name for Vpc2 field in VpcPeering
	Vpc2RelationName = "Vpc2"

	// VpcPeering default field to be used for ordering when non specified
	VpcPeeringOrderByDefault = "created"
)
View Source
const (
	// VpcPrefixStatusReady status is ready
	VpcPrefixStatusReady = "Ready"
	// VpcPrefixStatusError status is error
	VpcPrefixStatusError = "Error"
	// VpcPrefixStatusDeleting indicates that the VpcPrefix is being deleted
	VpcPrefixStatusDeleting = "Deleting"
	// VpcPrefixStatusDeleted indicates that the VpcPrefix has been deleted
	VpcPrefixStatusDeleted = "Deleted"
	// VpcPrefixRelationName is the relation name for the VpcPrefix model
	VpcPrefixRelationName = "VpcPrefix"

	// VpcPrefixOrderByDefault default field to be used for ordering when none specified
	VpcPrefixOrderByDefault = "created"
)
View Source
const (
	AuditEntryOrderByDefault = "timestamp"
)
View Source
const (
	// DpuExtensionServiceDeploymentRelationName is the relation name for the DpuExtensionServiceDeployment model
	DpuExtensionServiceDeploymentRelationName = "DpuExtensionServiceDeployment"
)
View Source
const (
	// ExpectedMachineOrderByDefault default field to be used for ordering when none specified
	ExpectedMachineOrderByDefault = "created"
)
View Source
const (
	// ExpectedPowerShelfOrderByDefault default field to be used for ordering when none specified
	ExpectedPowerShelfOrderByDefault = "created"
)
View Source
const (
	// ExpectedRackOrderByDefault default field to be used for ordering when none specified
	ExpectedRackOrderByDefault = "created"
)
View Source
const (
	// ExpectedSwitchOrderByDefault default field to be used for ordering when none specified
	ExpectedSwitchOrderByDefault = "created"
)
View Source
const (
	// FabricRelationName is the relation name for the Fabric model
	FabricRelationName = "Fabric"
)
View Source
const (
	// InfrastructureProviderRelationName is the relation name for the InfrastructureProvider model
	InfrastructureProviderRelationName = "InfrastructureProvider"
)
View Source
const NetworkSecurityGroupInitialVersion = "V0-T0"
View Source
const (
	// SSHKeyAssociationOrderByDefault default field to be used for ordering when none specified
	SSHKeyAssociationOrderByDefault = "created"
)
View Source
const (
	// SSHKeyGroupInstanceAssociationOrderByDefault default field to be used for ordering when none specified
	SSHKeyGroupInstanceAssociationOrderByDefault = "created"
)
View Source
const (
	// SSHKeyGroupRelationName is the relation name for the SSHKey model
	SSHKeyGroupRelationName = "SSHKeyGroup"
)
View Source
const (
	// StatusDetailRelationName is the relation name for the StatusDetail model
	StatusDetailRelationName = "StatusDetail"
)
View Source
const (
	// TenantRelationName is the relation name for the Tenant model
	TenantRelationName = "Tenant"
)
View Source
const (
	// TenantSiteOrderByDefault default field to be used for ordering when none specified
	TenantSiteOrderByDefault = "created"
)

Variables

View Source
var (
	// AllocationOrderByFields is the external list of fields that can be used for sorting
	AllocationOrderByFields = []string{
		allocationOrderByName,
		allocationOrderByStatus,
		allocationOrderByCreated,
		allocationOrderByUpdated,
		allocationOrderBySiteNameExt,
		allocationOrderByTenantOrgDisplayNameExt,
		allocationOrderByInstanceTypeName,
		allocationOrderByIPBlockName,
		allocationOrderByConstraintValue,
	}

	// AllocationRelatedEntities is a list of valid relation by fields for the Allocation model
	AllocationRelatedEntities = map[string]bool{
		InfrastructureProviderRelationName: true,
		TenantRelationName:                 true,
		SiteRelationName:                   true,
	}
	// AllocationStatusMap is a list of valid status for the Allocation model
	AllocationStatusMap = map[string]bool{
		AllocationStatusPending:    true,
		AllocationStatusRegistered: true,
		AllocationStatusError:      true,
		AllocationStatusDeleting:   true,
	}
)
View Source
var (
	// AllocationConstraintOrderByFields is a list of valid order by fields for the AllocationConstraint model
	AllocationConstraintOrderByFields = []string{"resource_type", "created", "updated"}
	// AllocationConstraintRelatedEntities is a list of valid relation by fields for the AllocationConstraint model
	AllocationConstraintRelatedEntities = map[string]bool{
		AllocationRelationName: true,
	}
	// AllocationConstraintResourceTypes is a list of valid resourcetypes for the AllocationConstraint model
	AllocationConstraintResourceTypes = map[string]bool{
		AllocationResourceTypeInstanceType: true,
		AllocationResourceTypeIPBlock:      true,
	}
	AllocationConstraintTypeMap = map[string]bool{
		AllocationConstraintTypeReserved:    true,
		AllocationConstraintTypeOnDemand:    true,
		AllocationConstraintTypePreemptible: true,
	}
)
View Source
var (
	// DpuExtensionServiceStatusMap is a list of valid status for the DpuExtensionService model
	DpuExtensionServiceStatusMap = map[string]bool{
		DpuExtensionServiceStatusPending:  true,
		DpuExtensionServiceStatusReady:    true,
		DpuExtensionServiceStatusError:    true,
		DpuExtensionServiceStatusDeleting: true,
	}

	// DpuExtensionServiceOrderByFields is a list of valid order by fields for the DpuExtensionService model
	DpuExtensionServiceOrderByFields = []string{"id", "name", "status", "created", "updated"}
	// DpuExtensionServiceRelatedEntities is a list of valid relation by fields for the DpuExtensionService model
	DpuExtensionServiceRelatedEntities = map[string]bool{
		SiteRelationName:     true,
		TenantRelationName:   true,
		InstanceRelationName: true,
	}

	// DpuExtensionServiceServiceTypeKubernetesPod indicates an extension service running as a Kubernetes pod
	DpuExtensionServiceServiceTypeKubernetesPod = "KubernetesPod"

	// DpuExtensionServiceServiceTypeMap is a map of valid service types for the DpuExtensionService model
	DpuExtensionServiceServiceTypeMap = map[string]bool{
		DpuExtensionServiceServiceTypeKubernetesPod: true,
	}
)
View Source
var (
	// DpuExtensionServiceDeploymentStatusMap is a list of valid status for the DpuExtensionServiceDeployment model
	DpuExtensionServiceDeploymentStatusMap = map[string]bool{
		DpuExtensionServiceDeploymentStatusPending:     true,
		DpuExtensionServiceDeploymentStatusRunning:     true,
		DpuExtensionServiceDeploymentStatusError:       true,
		DpuExtensionServiceDeploymentStatusFailed:      true,
		DpuExtensionServiceDeploymentStatusTerminating: true,
	}

	// DpuExtensionServiceDeploymentOrderByFields is a list of valid order by fields for the DpuExtensionServiceDeployment model
	DpuExtensionServiceDeploymentOrderByFields = []string{"id", "status", "created", "updated"}
	// DpuExtensionServiceDeploymentRelatedEntities is a list of valid relation by fields for the DpuExtensionServiceDeployment model
	DpuExtensionServiceDeploymentRelatedEntities = map[string]bool{
		SiteRelationName:     true,
		TenantRelationName:   true,
		InstanceRelationName: true,
	}
)
View Source
var (
	// ExpectedMachineOrderByFields is a list of valid order by fields for the ExpectedMachine model
	ExpectedMachineOrderByFields = []string{
		"id",
		"site_id",
		"bmc_mac_address",
		"chassis_serial_number",
		"created",
		"updated",
	}
	// ExpectedMachineRelatedEntities is a list of valid relation by fields for the ExpectedMachine model
	ExpectedMachineRelatedEntities = map[string]bool{
		SiteRelationName:    true,
		SkuRelationName:     true,
		MachineRelationName: true,
	}
)
View Source
var (
	// ExpectedPowerShelfOrderByFields is a list of valid order by fields for the ExpectedPowerShelf model
	ExpectedPowerShelfOrderByFields = []string{
		"id",
		"site_id",
		"bmc_mac_address",
		"shelf_serial_number",
		"created",
		"updated",
	}
	// ExpectedPowerShelfRelatedEntities is a list of valid relation by fields for the ExpectedPowerShelf model
	ExpectedPowerShelfRelatedEntities = map[string]bool{
		SiteRelationName: true,
	}
)
View Source
var (
	// ExpectedRackOrderByFields is a list of valid order by fields for the ExpectedRack model
	ExpectedRackOrderByFields = []string{
		"id",
		"rack_id",
		"site_id",
		"rack_profile_id",
		"name",
		"created",
		"updated",
	}
	// ExpectedRackRelatedEntities is a list of valid relation by fields for the ExpectedRack model
	ExpectedRackRelatedEntities = map[string]bool{
		SiteRelationName: true,
	}
)
View Source
var (
	// ExpectedSwitchOrderByFields is a list of valid order by fields for the ExpectedSwitch model
	ExpectedSwitchOrderByFields = []string{
		"id",
		"site_id",
		"bmc_mac_address",
		"switch_serial_number",
		"created",
		"updated",
	}
	// ExpectedSwitchRelatedEntities is a list of valid relation by fields for the ExpectedSwitch model
	ExpectedSwitchRelatedEntities = map[string]bool{
		SiteRelationName: true,
	}
)
View Source
var (
	// FabricOrderByFields is a list of valid order by fields for the Fabric model
	FabricOrderByFields = []string{"id", "status", "created", "updated"}
	// FabricRelatedEntities is a list of valid relation by fields for the Fabric model
	FabricRelatedEntities = map[string]bool{
		SiteRelationName:                   true,
		InfrastructureProviderRelationName: true,
	}
)
View Source
var (
	// InfiniBandInterfaceOrderByFields is a list of valid order by fields for the Subnet model
	InfiniBandInterfaceOrderByFields = []string{"status", "created", "updated"}
	// InfiniBandInterfaceRelatedEntities is a list of valid relation by fields for the InfiniBandInterface model
	InfiniBandInterfaceRelatedEntities = map[string]bool{
		SiteRelationName:                true,
		InstanceRelationName:            true,
		InfiniBandPartitionRelationName: true,
	}
	// InfiniBandInterfaceStatusMap is a list of valid status for the InfiniBandInterface model
	InfiniBandInterfaceStatusMap = map[string]bool{
		InfiniBandInterfaceStatusPending:      true,
		InfiniBandInterfaceStatusProvisioning: true,
		InfiniBandInterfaceStatusReady:        true,
		InfiniBandInterfaceStatusError:        true,
		InfiniBandInterfaceStatusDeleting:     true,
	}
)
View Source
var (
	// InfiniBandPartitionOrderByFields is a list of valid order by fields for the InfiniBandPartition model
	InfiniBandPartitionOrderByFields = []string{"name", "status", "created", "updated"}
	// InfiniBandPartitionRelatedEntities is a list of valid relation by fields for the InfiniBandPartition model
	InfiniBandPartitionRelatedEntities = map[string]bool{
		SiteRelationName:   true,
		TenantRelationName: true,
	}
	// InfiniBandPartitionStatusMap is a list of valid status for the InfiniBandPartition model
	InfiniBandPartitionStatusMap = map[string]bool{
		InfiniBandPartitionStatusPending:      true,
		InfiniBandPartitionStatusProvisioning: true,
		InfiniBandPartitionStatusReady:        true,
		InfiniBandPartitionStatusConfiguring:  true,
		InfiniBandPartitionStatusError:        true,
		InfiniBandPartitionStatusDeleting:     true,
	}
)
View Source
var (
	// InstanceOrderByFields is a list of valid order by fields for the Instance model
	InstanceOrderByFields = []string{
		instanceOrderByName,
		instanceOrderByStatus,
		instanceOrderByCreated,
		instanceOrderByUpdated,
		instanceOrderByMachineID,
		instanceOrderByTenantOrgDisplayNameExt,
		instanceOrderByInstanceTypeNameExt,
		instanceOrderByHasInfiniBandExt,
		instanceOrderByNetworkSecurityGroupNameExt,
		instanceOrderByNetworkSecurityGroupNameInt,
	}

	// InstanceRelatedEntities is a list of valid relation by fields for the Instance model
	InstanceRelatedEntities = map[string]bool{
		InfrastructureProviderRelationName: true,
		SiteRelationName:                   true,
		InstanceTypeRelationName:           true,
		NetworkSecurityGroupRelationName:   true,
		TenantRelationName:                 true,
		VpcRelationName:                    true,
		MachineRelationName:                true,
		OperatingSystemRelationName:        true,
	}
	// InstanceStatusMap is a list of valid status for the Instance model
	InstanceStatusMap = map[string]bool{
		InstanceStatusPending:            true,
		InstanceStatusReady:              true,
		InstanceStatusUpdating:           true,
		InstanceStatusRepairing:          true,
		InstanceStatusError:              true,
		InstanceStatusConfiguring:        true,
		InstanceStatusProvisioning:       true,
		InstanceStatusTerminating:        true,
		InstanceStatusTerminated:         true,
		InstancePowerStatusBootCompleted: true,
		InstancePowerStatusRebooting:     true,
	}
)
View Source
var (
	// InstanceTypeStatusChoices returns the list of possible status choices
	InstanceTypeStatusChoices = []string{
		InstanceTypeStatusPending,
		InstanceTypeStatusRegistering,
		InstanceTypeStatusReady,
		InstanceTypeStatusError,
	}

	// InstanceTypeOrderByFields is a list of valid order by fields for the InstanceType model
	InstanceTypeOrderByFields = []string{"name", "status", "created", "updated"}
	// InstanceTypeRelatedEntities is a list of valid relation by fields for the InstanceType model
	InstanceTypeRelatedEntities = map[string]bool{InfrastructureProviderRelationName: true, SiteRelationName: true}
	// InstanceTypeStatusMap is a list of valid status for the InstanceType model
	InstanceTypeStatusMap = map[string]bool{
		InstanceTypeStatusPending:     true,
		InstanceTypeStatusRegistering: true,
		InstanceTypeStatusReady:       true,
		InstanceTypeStatusError:       true,
		InstanceTypeStatusDeleting:    true,
	}
)
View Source
var (
	// InterfaceOrderByFields is a list of valid order by fields for the Interface model
	InterfaceOrderByFields = []string{"status", "created", "updated"}
	// InterfaceRelatedEntities is a list of valid relation by fields for the Interface model
	InterfaceRelatedEntities = map[string]bool{InstanceRelationName: true, SubnetRelationName: true, VpcPrefixRelationName: true}
	// InterfaceStatusMap is a list of valid status for the Interface model
	InterfaceStatusMap = map[string]bool{
		InterfaceStatusPending:      true,
		InterfaceStatusReady:        true,
		InterfaceStatusError:        true,
		InterfaceStatusDeleting:     true,
		InterfaceStatusProvisioning: true,
	}
)
View Source
var (
	// IPBlockOrderByFields is a list of valid order by fields for the IPBlock model
	IPBlockOrderByFields = []string{"name", "prefix", "status", "created", "updated"}
	// IPBlockRelatedEntities is a list of valid relation by fields for the IPBlock model
	IPBlockRelatedEntities = map[string]bool{
		SiteRelationName:                   true,
		InfrastructureProviderRelationName: true,
		TenantRelationName:                 true,
	}
	// IPBlockStatusMap is a list of valid status for the IPBlock model
	IPBlockStatusMap = map[string]bool{
		IPBlockStatusPending:      true,
		IPBlockStatusProvisioning: true,
		IPBlockStatusReady:        true,
		IPBlockStatusError:        true,
		IPBlockStatusDeleting:     true,
	}
)
View Source
var (
	// MachineOrderByFields is a list of valid order by fields for the Machine model
	MachineOrderByFields = []string{"id", "status", "created", "updated"}
	// MachineRelatedEntities is a list of valid relation by fields for the Machine model
	MachineRelatedEntities = map[string]bool{
		InfrastructureProviderRelationName: true,
		SiteRelationName:                   true,
		InstanceTypeRelationName:           true,
	}
	// MachineStatusMap is a list of valid status for the Machine model
	MachineStatusMap = map[string]bool{
		MachineStatusInitializing:   true,
		MachineStatusReady:          true,
		MachineStatusReset:          true,
		MachineStatusMaintenance:    true,
		MachineStatusInUse:          true,
		MachineStatusError:          true,
		MachineStatusDecommissioned: true,
		MachineStatusUnknown:        true,
	}
)
View Source
var (

	// MachineCapabilityTypeChoiceMap is a map of valid MachineCapability types
	MachineCapabilityTypeChoiceMap = map[string]bool{
		MachineCapabilityTypeCPU:        true,
		MachineCapabilityTypeMemory:     true,
		MachineCapabilityTypeGPU:        true,
		MachineCapabilityTypeStorage:    true,
		MachineCapabilityTypeNetwork:    true,
		MachineCapabilityTypeInfiniBand: true,
		MachineCapabilityTypeDPU:        true,
	}

	// MachineCapabilityOrderByFields is a list of valid order by fields for the MachineCapability model
	MachineCapabilityOrderByFields = []string{"type", "created", "updated"}

	// MachineCapabilityDeviceTypeChoiceMap is a map of valid MachineCapability device types
	MachineCapabilityDeviceTypeChoiceMap = map[string]bool{
		MachineCapabilityDeviceTypeDPU:    true,
		MachineCapabilityDeviceTypeNVLink: true,
	}
)
View Source
var (
	// NetworkSecurityGroupOrderByFields is a list of valid order by fields for the NetworkSecurityGroup model
	NetworkSecurityGroupOrderByFields = []string{"name", "status", "created", "updated"}
	// NetworkSecurityGroupRelatedEntities is a list of valid relation by fields for the NetworkSecurityGroup model
	NetworkSecurityGroupRelatedEntities = map[string]bool{
		SiteRelationName:   true,
		TenantRelationName: true,
	}
	// NetworkSecurityGroupStatusMap is a list of valid status for the NetworkSecurityGroup model
	NetworkSecurityGroupStatusMap = map[string]bool{
		NetworkSecurityGroupStatusPending:      true,
		NetworkSecurityGroupStatusProvisioning: true,
		NetworkSecurityGroupStatusDeleting:     true,
		NetworkSecurityGroupStatusReady:        true,
		NetworkSecurityGroupStatusError:        true,
	}
)
View Source
var (
	// NVLinkInterfaceOrderByFields is a list of valid order by fields for the Subnet model
	NVLinkInterfaceOrderByFields = []string{"status", "created", "updated"}
	// NVLinkInterfaceRelatedEntities is a list of valid relation by fields for the NVLinkInterface model
	NVLinkInterfaceRelatedEntities = map[string]bool{
		SiteRelationName:                   true,
		InstanceRelationName:               true,
		NVLinkLogicalPartitionRelationName: true,
	}
	// NVLinkInterfaceStatusMap is a list of valid status for the NVLinkInterface model
	NVLinkInterfaceStatusMap = map[string]bool{
		NVLinkInterfaceStatusPending:      true,
		NVLinkInterfaceStatusProvisioning: true,
		NVLinkInterfaceStatusReady:        true,
		NVLinkInterfaceStatusError:        true,
		NVLinkInterfaceStatusDeleting:     true,
	}
)
View Source
var (
	// NVLinkLogicalPartitionOrderByFields is a list of valid order by fields for the NVLinkLogicalPartition model
	NVLinkLogicalPartitionOrderByFields = []string{"name", "status", "created", "updated"}
	// NVLinkLogicalPartitionRelatedEntities is a list of valid relation by fields for the NVLinkLogicalPartition model
	NVLinkLogicalPartitionRelatedEntities = map[string]bool{
		SiteRelationName:   true,
		TenantRelationName: true,
	}
	// NVLinkLogicalPartitionStatusMap is a list of valid status for the NVLinkLogicalPartition model
	NVLinkLogicalPartitionStatusMap = map[string]bool{
		NVLinkLogicalPartitionStatusPending:      true,
		NVLinkLogicalPartitionStatusProvisioning: true,
		NVLinkLogicalPartitionStatusReady:        true,
		NVLinkLogicalPartitionStatusConfiguring:  true,
		NVLinkLogicalPartitionStatusError:        true,
		NVLinkLogicalPartitionStatusDeleting:     true,
	}
)
View Source
var (
	// OperatingSystemOrderByFields is a list of valid order by fields for the OperatingSystem model
	OperatingSystemOrderByFields = []string{"name", "version", "status", "is_cloud_init", "created", "updated"}
	// OperatingSystemRelatedEntities is a list of valid relation by fields for the OperatingSystem model
	OperatingSystemRelatedEntities = map[string]bool{
		InfrastructureProviderRelationName: true,
		TenantRelationName:                 true,
	}
	// OperatingSystemStatusMap is a list of valid status for the OperatingSystem model
	OperatingSystemStatusMap = map[string]bool{
		OperatingSystemStatusPending:      true,
		OperatingSystemStatusProvisioning: true,
		OperatingSystemStatusReady:        true,
		OperatingSystemStatusError:        true,
		OperatingSystemStatusDeleting:     true,
		OperatingSystemStatusSyncing:      true,
		OperatingSystemStatusDeactivated:  true,
	}
	//OperatingSystemsTypeMap is a list of valid type for the OperatingSystem model
	OperatingSystemsTypeMap = map[string]bool{
		OperatingSystemTypeIPXE:  true,
		OperatingSystemTypeImage: true,
	}
)
View Source
var (
	// OperatingSystemSiteAssociationOrderByFields is a list of valid order by fields for the OperatingSystemSiteAssociation model
	OperatingSystemSiteAssociationOrderByFields = []string{"status", "created", "updated"}

	// OperatingSystemSiteAssociationRelatedEntities is a list of valid relation by fields for the OperatingSystemSiteAssociation model
	OperatingSystemSiteAssociationRelatedEntities = map[string]bool{
		OperatingSystemRelationName: true,
	}

	// OperatingSystemSiteAssociationEntityTypes is a list of valid choices for the EntityType field
	OperatingSystemSiteAssociationEntityTypes = map[string]bool{
		SiteRelationName:            true,
		OperatingSystemRelationName: true,
	}
)
View Source
var (
	// SiteOrderByFields is a list of valid order by fields for the Site model
	SiteOrderByFields = []string{"name", "status", "created", "updated", "description", "location", "contact"}
	// SiteRelatedEntities is a list of valid relation by fields for the Site model
	SiteRelatedEntities = map[string]bool{InfrastructureProviderRelationName: true}
	// SiteStatusMap is a list of valid status for the Site model
	SiteStatusMap = map[string]bool{
		SiteStatusPending:    true,
		SiteStatusRegistered: true,
		SiteStatusError:      true,
	}
)
View Source
var (
	// SkuOrderByFields is a list of valid order by fields for the SKU model
	SkuOrderByFields = []string{SkuOrderByCreated, skuOrderByUpdated}
	// SkuRelatedEntities is a list of valid relation by fields for the Sku model
	SkuRelatedEntities = map[string]bool{
		SiteRelationName: true,
	}
)
View Source
var (
	// SSHKeyOrderByFields is a list of valid order by fields for the Instance model
	SSHKeyOrderByFields = []string{"name", "org", "tenant_id", "created", "updated"}
	// SSHKeyRelatedEntities is a list of valid relation by fields for the SSHKey model
	SSHKeyRelatedEntities = map[string]bool{
		TenantRelationName: true,
	}
)
View Source
var (
	// SSHKeyAssociationOrderByFields is a list of valid order by fields for the Instance model
	SSHKeyAssociationOrderByFields = []string{"created", "updated"}

	// SSHKeyAssociationRelatedEntities is a list of valid relation by fields for the SSHKeyAssociation model
	SSHKeyAssociationRelatedEntities = map[string]bool{
		SSHKeyRelationName:      true,
		SSHKeyGroupRelationName: true,
	}
)
View Source
var (
	// SSHKeyGroupOrderByFields is a list of valid order by fields for the SSHKeyGroup model
	SSHKeyGroupOrderByFields = []string{"name", "status", "created", "updated"}
	// SSHKeyGroupRelatedEntities is a list of valid relation by fields for the SSHKeyGroup model
	SSHKeyGroupRelatedEntities = map[string]bool{
		TenantRelationName: true,
	}
)
View Source
var (
	// SSHKeyGroupInstanceAssociationOrderByFields is a list of valid order by fields for the SSHKeyGroupInstanceAssociation model
	SSHKeyGroupInstanceAssociationOrderByFields = []string{"created", "updated"}

	// SSHKeyGroupInstanceAssociationRelatedEntities is a list of valid relation by fields for the SSHKeyGroupInstanceAssociation model
	SSHKeyGroupInstanceAssociationRelatedEntities = map[string]bool{
		SSHKeyGroupRelationName: true,
		SiteRelationName:        true,
		InstanceRelationName:    true,
	}

	// SSHKeyGroupInstanceAssociationEntityTypes is a list of valid choices for the EntityType field
	SSHKeyGroupInstanceAssociationEntityTypes = map[string]bool{
		InstanceRelationName:    true,
		SiteRelationName:        true,
		SSHKeyGroupRelationName: true,
	}
)
View Source
var (
	// SSHKeyGroupSiteAssociationOrderByFields is a list of valid order by fields for the SSHKeyGroupSiteAssociation model
	SSHKeyGroupSiteAssociationOrderByFields = []string{"status", "created", "updated"}

	// SSHKeyGroupSiteAssociationRelatedEntities is a list of valid relation by fields for the SSHKeyGroupSiteAssociation model
	SSHKeyGroupSiteAssociationRelatedEntities = map[string]bool{
		SSHKeyGroupRelationName: true,
	}

	// SSHKeyGroupSiteAssociationEntityTypes is a list of valid choices for the EntityType field
	SSHKeyGroupSiteAssociationEntityTypes = map[string]bool{
		SiteRelationName:        true,
		SSHKeyGroupRelationName: true,
	}
)
View Source
var (
	// StatusDetailOrderByFields is a list of valid order by fields for the StatusDetail model
	StatusDetailOrderByFields = []string{"status", "created", "updated"}
	// StatusDetailOrderByDefault default field to be used for ordering when none specified
	StatusDetailOrderByDefault = "created"
)
View Source
var (
	// SubnetOrderByFields is a list of valid order by fields for the Subnet model
	SubnetOrderByFields = []string{"name", "status", "created", "updated"}
	// SubnetRelatedEntities is a list of valid relation by fields for the Subnet model
	SubnetRelatedEntities = map[string]bool{
		SiteRelationName:      true,
		VpcRelationName:       true,
		TenantRelationName:    true,
		IPv4BlockRelationName: true,
		IPv6BlockRelationName: true,
	}
	// SubnetStatusMap is a list of valid status for the Subnet model
	SubnetStatusMap = map[string]bool{
		SubnetStatusPending:      true,
		SubnetStatusProvisioning: true,
		SubnetStatusReady:        true,
		SubnetStatusDeleting:     true,
		SubnetStatusDeleted:      true,
		SubnetStatusError:        true,
	}
)
View Source
var (
	// TenantAccountOrderByFields is the external list of fields that can be used for sorting
	TenantAccountOrderByFields = []string{
		tenantAccountOrderByNumber,
		tenantAccountOrderByStatus,
		tenantAccountOrderByCreated,
		tenantAccountOrderByUpdated,
		tenantAccountOrderByTenantOrgNameExt,
		tenantAccountOrderByTenantOrgDisplayNameExt,
		tenantAccountOrderByTenantContactEmailExt,
		tenantAccountOrderByTenantContactFullNameExt,
	}

	// TenantAccountRelatedEntities is a list of valid relation by fields for the TenantAccount model
	TenantAccountRelatedEntities = map[string]bool{
		InfrastructureProviderRelationName: true,
		TenantRelationName:                 true,
		TenantContactRelationName:          true,
	}
	// TenantAccountStatusList is a list of valid status for the TenantAccount model
	TenantAccountStatusList = []string{
		TenantAccountStatusPending,
		TenantAccountStatusInvited,
		TenantAccountStatusReady,
		TenantAccountStatusError,
	}

	// TenantAccountStatusMap is a list of valid status for the TenantAccount model
	TenantAccountStatusMap = map[string]bool{
		TenantAccountStatusPending: true,
		TenantAccountStatusInvited: true,
		TenantAccountStatusReady:   true,
		TenantAccountStatusError:   true,
	}
)
View Source
var (
	// TenantSiteOrderByFields is a list of valid order by fields for the TenantSite model
	TenantSiteOrderByFields = []string{"created", "updated"}
	// TenantSitetRelatedEntities is a list of valid relation by fields for the TenantSite model
	TenantSitetRelatedEntities = map[string]bool{
		TenantRelationName: true,
		SiteRelationName:   true,
	}
)
View Source
var (
	// VpcOrderByFields is a list of valid order by fields for the Subnet model
	VpcOrderByFields = []string{"name", "status", "created", "updated"}
	// VpcRelatedEntities is a list of valid relation by fields for the VPC model
	VpcRelatedEntities = map[string]bool{
		InfrastructureProviderRelationName: true,
		SiteRelationName:                   true,
		TenantRelationName:                 true,
		NetworkSecurityGroupRelationName:   true,
		NVLinkLogicalPartitionRelationName: true,
	}
	// VpcStatusMap is a list of valid status for the VPC model
	VpcStatusMap = map[string]bool{
		VpcStatusPending:      true,
		VpcStatusProvisioning: true,
		VpcStatusReady:        true,
		VpcStatusError:        true,
		VpcStatusDeleting:     true,
	}

	// VpcNetworkVirtualzationTypeMap is a list of supported network virtulization for the VPC model
	VpcNetworkVirtualzationTypeMap = map[string]bool{
		VpcEthernetVirtualizer: true,
		VpcFNN:                 true,
	}
)
View Source
var (
	VpcPeeringOrderByFields = []string{"id", "vpc1_id", "vpc2_id", "site_id", "created", "updated"}
	// VpcPeeringRelatedEntities is a list of valid relation by fields for the VpcPeering model
	VpcPeeringRelatedEntities = map[string]bool{
		Vpc1RelationName:                   true,
		Vpc2RelationName:                   true,
		SiteRelationName:                   true,
		InfrastructureProviderRelationName: true,
		TenantRelationName:                 true,
	}
)
View Source
var (
	// VpcPrefixOrderByFields is a list of valid order by fields for the VpcPrefix model
	VpcPrefixOrderByFields = []string{"name", "status", "created", "updated"}
	// VpcPrefixRelatedEntities is a list of valid relation by fields for the VpcPrefix model
	VpcPrefixRelatedEntities = map[string]bool{
		SiteRelationName:    true,
		VpcRelationName:     true,
		TenantRelationName:  true,
		IPBlockRelationName: true,
	}
	// VpcPrefixStatusMap is a list of valid status for the VpcPrefix model
	VpcPrefixStatusMap = map[string]bool{
		VpcPrefixStatusReady:    true,
		VpcPrefixStatusError:    true,
		VpcPrefixStatusDeleting: true,
		VpcPrefixStatusDeleted:  true,
	}
)
View Source
var (
	// AuditEntryOrderByFields is a list of valid order by fields for the AuditEntry model
	AuditEntryOrderByFields = []string{"timestamp"}
)
View Source
var (
	// DomainStatusMap is a list of valid status for the Domain model
	DomainStatusMap = map[string]bool{
		DomainStatusPending:     true,
		DomainStatusReady:       true,
		DomainStatusError:       true,
		DomainStatusRegistering: true,
	}
)
View Source
var (
	// FabricStatusMap is a list of valid status for the Faric model
	FabricStatusMap = map[string]bool{
		FabricStatusPending:  true,
		FabricStatusReady:    true,
		FabricStatusError:    true,
		FabricStatusDeleting: true,
	}
)
View Source
var (
	// MachineInstanceTypeOrderByFields is a list of valid order by fields for the MachineInstanceType model
	MachineInstanceTypeOrderByFields = []string{"created", "updated"}
)
View Source
var (
	// MachineInterfaceOrderByFields is a list of valid order by fields for the MachineInterface model
	MachineInterfaceOrderByFields = []string{"hostname", "created", "updated"}
)
View Source
var (
	// OperatingSystemSiteAssociationStatusSyncingMap is a list of valid status for the OperatingSystemSiteAssociation model
	OperatingSystemSiteAssociationStatusSyncingMap = map[string]bool{
		OperatingSystemSiteAssociationStatusSyncing:  true,
		OperatingSystemSiteAssociationStatusSynced:   true,
		OperatingSystemSiteAssociationStatusError:    true,
		OperatingSystemSiteAssociationStatusDeleting: true,
	}
)
View Source
var (
	// SSHKeyGroupMap is a list of valid status for the SSHKeyGroup model
	SSHKeyGroupMap = map[string]bool{
		SSHKeyGroupStatusSyncing:  true,
		SSHKeyGroupStatusSynced:   true,
		SSHKeyGroupStatusError:    true,
		SSHKeyGroupStatusDeleting: true,
	}
)
View Source
var (
	// SSHKeyGroupSiteAssociationStatusSyncingMap is a list of valid status for the SSHKeyGroupSiteAssociation model
	SSHKeyGroupSiteAssociationStatusSyncingMap = map[string]bool{
		SSHKeyGroupSiteAssociationStatusSyncing:  true,
		SSHKeyGroupSiteAssociationStatusSynced:   true,
		SSHKeyGroupSiteAssociationStatusError:    true,
		SSHKeyGroupSiteAssociationStatusDeleting: true,
	}
)
View Source
var (
	// UserOrderByFields is a list of valid order by fields for the User model
	UserOrderByFields = []string{"created"}
)

Functions

func TestSetupSchema

func TestSetupSchema(t *testing.T, dbSession *db.Session)

TestSetupSchema creates/resets the schema

Types

type Allocation

type Allocation struct {
	bun.BaseModel `bun:"table:allocation,alias:a"`

	ID                       uuid.UUID               `bun:"type:uuid,pk"`
	Name                     string                  `bun:"name,notnull"`
	Description              *string                 `bun:"description"`
	InfrastructureProviderID uuid.UUID               `bun:"infrastructure_provider_id,type:uuid,notnull"`
	InfrastructureProvider   *InfrastructureProvider `bun:"rel:belongs-to,join:infrastructure_provider_id=id"`
	TenantID                 uuid.UUID               `bun:"tenant_id,type:uuid,notnull"`
	Tenant                   *Tenant                 `bun:"rel:belongs-to,join:tenant_id=id"`
	SiteID                   uuid.UUID               `bun:"site_id,type:uuid,notnull"`
	Site                     *Site                   `bun:"rel:belongs-to,join:site_id=id"`
	Status                   string                  `bun:"status,notnull"`
	Created                  time.Time               `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                  time.Time               `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                  *time.Time              `bun:"deleted,soft_delete"`
	CreatedBy                uuid.UUID               `bun:"type:uuid,notnull"`
	// Following fields are not for display, used by the query that sorts on instance type name
	InstanceTypeName string `bun:"instance_type_name,scanonly"`
	IPBlockName      string `bun:"ip_block_name,scanonly"`
	ConstraintValue  string `bun:"constraint_value,scanonly"`
}

Allocation specifies a portion of a Site that has been allocated to a Tenant

func TestBuildAllocation

func TestBuildAllocation(t *testing.T, dbSession *db.Session, name string, st *Site, tn *Tenant, user *User) *Allocation

TestBuildAllocation creates a test Allocation

func (*Allocation) BeforeAppendModel

func (a *Allocation) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*Allocation) BeforeCreateTable

func (a *Allocation) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type AllocationClearInput

type AllocationClearInput struct {
	AllocationID uuid.UUID
	Description  bool
}

type AllocationConstraint

type AllocationConstraint struct {
	bun.BaseModel `bun:"table:allocation_constraint,alias:ac"`

	ID                uuid.UUID   `bun:"type:uuid,pk"`
	AllocationID      uuid.UUID   `bun:"allocation_id,type:uuid,notnull"`
	Allocation        *Allocation `bun:"rel:belongs-to,join:allocation_id=id"`
	ResourceType      string      `bun:"resource_type,notnull"` // AllocationResourceType
	ResourceTypeID    uuid.UUID   `bun:"resource_type_id,type:uuid,notnull"`
	ConstraintType    string      `bun:"constraint_type,notnull"` // AllocationConstraintType
	ConstraintValue   int         `bun:"constraint_value,notnull"`
	DerivedResourceID *uuid.UUID  `bun:"derived_resource_id,type:uuid"` // Valid for IPBlock
	Created           time.Time   `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated           time.Time   `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted           *time.Time  `bun:"deleted,soft_delete"`
	CreatedBy         uuid.UUID   `bun:"type:uuid,notnull"`
}

AllocationConstraint represents entries in the allocation_constraint table Constraints an allocation by specifying limits for different resource types

func TestBuildAllocationConstraint

func TestBuildAllocationConstraint(t *testing.T, dbSession *db.Session, al *Allocation, it *InstanceType, ipb *IPBlock, constraintValue int, user *User) *AllocationConstraint

TestBuildAllocationConstraint creates a test Allocation Constraint of Instance Type

func (*AllocationConstraint) BeforeAppendModel

func (ac *AllocationConstraint) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*AllocationConstraint) BeforeCreateTable

func (ac *AllocationConstraint) BeforeCreateTable(ctx context.Context,
	query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created This is only used in tests

func (*AllocationConstraint) GetIndentedJSON

func (ac *AllocationConstraint) GetIndentedJSON() ([]byte, error)

GetIndentedJSON returns formatted json of AllocationConstraint

type AllocationConstraintDAO

type AllocationConstraintDAO interface {
	//
	CreateFromParams(ctx context.Context, tx *db.Tx,
		allocationID uuid.UUID, resourceType string,
		resourceTypeID uuid.UUID, constraintType string,
		constraintValue int, derivedResourceID *uuid.UUID,
		createdBy uuid.UUID) (*AllocationConstraint, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID,
		includeRelations []string) (*AllocationConstraint, error)
	//
	GetAll(ctx context.Context, tx *db.Tx,
		allocationIDs []uuid.UUID, resourceType *string,
		resourceTypeID []uuid.UUID, constraintType *string,
		derivedResourceID *uuid.UUID, includeRelations []string,
		offset *int, limit *int, orderBy *paginator.OrderBy) ([]AllocationConstraint, int, error)
	//
	UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID,
		allocationID *uuid.UUID, resourceType *string,
		resourceTypeID *uuid.UUID, constraintType *string,
		constraintValue *int, derivedResourceID *uuid.UUID) (*AllocationConstraint, error)
	//
	ClearFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID,
		derivedResourceID bool) (*AllocationConstraint, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

AllocationConstraintDAO is an interface for interacting with the AllocationConstraint model

func NewAllocationConstraintDAO

func NewAllocationConstraintDAO(dbSession *db.Session) AllocationConstraintDAO

NewAllocationConstraintDAO returns a new AllocationConstraintDAO

type AllocationConstraintSQLDAO

type AllocationConstraintSQLDAO struct {
	AllocationConstraintDAO
	// contains filtered or unexported fields
}

AllocationConstraintSQLDAO is an implementation of the AllocationConstraintDAO interface

func (AllocationConstraintSQLDAO) ClearFromParams

func (acd AllocationConstraintSQLDAO) ClearFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID,
	derivedResourceID bool) (*AllocationConstraint, error)

ClearFromParams sets parameters of an existing AllocationConstraint to null values in db since there are 2 operations (UPDATE, SELECT), it is required that this must be within a transaction

func (AllocationConstraintSQLDAO) CreateFromParams

func (acd AllocationConstraintSQLDAO) CreateFromParams(
	ctx context.Context, tx *db.Tx, allocationID uuid.UUID,
	resourceType string, resourceTypeID uuid.UUID,
	constraintType string, constraintValue int,
	derivedResourceID *uuid.UUID, createdBy uuid.UUID) (*AllocationConstraint, error)

CreateFromParams creates a new AllocationConstraint from the given parameters The returned AllocationConstraint will not have any related structs filled in since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (AllocationConstraintSQLDAO) DeleteByID

func (acd AllocationConstraintSQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error

DeleteByID deletes an AllocationConstraint by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (AllocationConstraintSQLDAO) GetAll

func (acd AllocationConstraintSQLDAO) GetAll(ctx context.Context, tx *db.Tx,
	allocationIDs []uuid.UUID, resourceType *string,
	resourceTypeIDs []uuid.UUID, constraintType *string,
	derivedResourceID *uuid.UUID, includeRelations []string,
	offset *int, limit *int, orderBy *paginator.OrderBy) ([]AllocationConstraint, int, error)

GetAll returns all AllocationConstraints for an InstanceType Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in AllocationConstraintOrderByDefault in ascending order

func (AllocationConstraintSQLDAO) GetByID

func (acd AllocationConstraintSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID,
	includeRelations []string) (*AllocationConstraint, error)

GetByID returns a AllocationConstraint by ID returns db.ErrDoesNotExist error if the record is not found

func (AllocationConstraintSQLDAO) UpdateFromParams

func (acd AllocationConstraintSQLDAO) UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID,
	allocationID *uuid.UUID, resourceType *string,
	resourceTypeID *uuid.UUID, constraintType *string,
	constraintValue *int, derivedResourceID *uuid.UUID) (*AllocationConstraint, error)

UpdateFromParams updates specified fields of an existing AllocationConstraint The updated fields are assumed to be set to non-null values since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

type AllocationCreateInput

type AllocationCreateInput struct {
	Name                     string
	Description              *string
	InfrastructureProviderID uuid.UUID
	TenantID                 uuid.UUID
	SiteID                   uuid.UUID
	Status                   string
	CreatedBy                uuid.UUID
}

type AllocationDAO

type AllocationDAO interface {
	// Create used to create new row
	Create(ctx context.Context, tx *db.Tx, input AllocationCreateInput) (*Allocation, error)
	// Update used to update row
	Update(ctx context.Context, tx *db.Tx, input AllocationUpdateInput) (*Allocation, error)
	// Delete used to delete row
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
	// Clear used to clear fields in the row
	Clear(ctx context.Context, tx *db.Tx, input AllocationClearInput) (*Allocation, error)
	// GetAll returns all the rows based on the filter and page inputs
	GetAll(ctx context.Context, tx *db.Tx, filter AllocationFilterInput, page paginator.PageInput, includeRelations []string) (allocations []Allocation, total int, err error)
	// GetByID returns row for specified ID
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Allocation, error)
	// GetCount returns total count of rows for specified filter
	GetCount(ctx context.Context, tx *db.Tx, filter AllocationFilterInput) (count int, err error)
}

AllocationDAO is an interface for interacting with the Allocation model

func NewAllocationDAO

func NewAllocationDAO(dbSession *db.Session) AllocationDAO

NewAllocationDAO returns a new AllocationDAO

type AllocationFilterInput

type AllocationFilterInput struct {
	Name                     *string
	InfrastructureProviderID *uuid.UUID
	TenantIDs                []uuid.UUID
	SiteIDs                  []uuid.UUID
	Statuses                 []string
	ResourceTypes            []string
	AllocationIDs            []uuid.UUID
	SearchQuery              *string
	ResourceTypeIDs          []uuid.UUID
	ConstraintTypes          []string
	ConstraintValues         []int
}

type AllocationSQLDAO

type AllocationSQLDAO struct {
	AllocationDAO
	// contains filtered or unexported fields
}

AllocationSQLDAO is an implementation of the AllocationDAO interface

func (AllocationSQLDAO) Clear

func (asd AllocationSQLDAO) Clear(ctx context.Context, tx *db.Tx, input AllocationClearInput) (*Allocation, error)

Clear sets parameters of an existing Allocation to null values in db parameters displayName, description, tenantID when true, the are set to null in db since there are 2 operations (UPDATE, SELECT), it is requireds that this must be within a transaction

func (AllocationSQLDAO) Create

func (asd AllocationSQLDAO) Create(ctx context.Context, tx *db.Tx, input AllocationCreateInput) (*Allocation, error)

Create creates a new Allocation from the given parameters The returned Allocation will not have any related structs (InfrastructureProvider/Tenant/Site) filled in since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (AllocationSQLDAO) Delete

func (asd AllocationSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes an Allocation by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (AllocationSQLDAO) GetAll

func (asd AllocationSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter AllocationFilterInput, page paginator.PageInput, includeRelations []string) ([]Allocation, int, error)

GetAll returns all Allocations Additional optional filters can be specified on infrastructureProviderID, tenantID, siteID errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in AllocationOrderByDefault in ascending order

func (AllocationSQLDAO) GetByID

func (asd AllocationSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Allocation, error)

GetByID returns a Allocation by ID includedRelation are a subset of "InfrastructureProvider", "Tenant", "Site" returns db.ErrDoesNotExist error if the record is not found

func (AllocationSQLDAO) GetCount

func (asd AllocationSQLDAO) GetCount(ctx context.Context, tx *db.Tx, filter AllocationFilterInput) (count int, err error)

func (AllocationSQLDAO) Update

func (asd AllocationSQLDAO) Update(ctx context.Context, tx *db.Tx, input AllocationUpdateInput) (*Allocation, error)

Update updates specified fields of an existing Allocation The updated fields are assumed to be set to non-null values For setting to null values, use: ClearFromParams since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

type AllocationUpdateInput

type AllocationUpdateInput struct {
	AllocationID             uuid.UUID
	Name                     *string
	Description              *string
	InfrastructureProviderID *uuid.UUID
	TenantID                 *uuid.UUID
	SiteID                   *uuid.UUID
	Status                   *string
}

type AuditEntry

type AuditEntry struct {
	bun.BaseModel `bun:"table:audit_entry,alias:ae"`

	ID            uuid.UUID              `bun:"id,type:uuid,pk"`
	Endpoint      string                 `bun:"endpoint,notnull"`
	QueryParams   url.Values             `bun:"query_params,type:jsonb"`
	Method        string                 `bun:"method,notnull"`                       // POST, PUT, DELETE, PATCH
	Body          map[string]interface{} `bun:"body,type:jsonb,notnull,default:'{}'"` // in JSON
	StatusCode    int                    `bun:"status_code,notnull"`
	StatusMessage string                 `bun:"status_message,notnull"`
	ClientIP      string                 `bun:"client_ip,notnull"`
	UserID        *uuid.UUID             `bun:"user_id,type:uuid"`
	OrgName       string                 `bun:"org_name,notnull"`
	ExtraData     map[string]interface{} `bun:"extra_data,type:jsonb,notnull,default:'{}'"` // in JSON
	Timestamp     time.Time              `bun:"timestamp,nullzero,notnull,default:current_timestamp"`
	Duration      time.Duration          `bun:"duration,nullzero,notnull"`
	APIVersion    string                 `bun:"api_version,notnull"`
}

type AuditEntryCreateInput

type AuditEntryCreateInput struct {
	Endpoint      string
	QueryParams   url.Values
	Method        string
	Body          map[string]interface{}
	StatusCode    int
	StatusMessage *string
	ClientIP      string
	UserID        *uuid.UUID
	OrgName       string
	ExtraData     map[string]interface{}
	Timestamp     time.Time
	Duration      time.Duration
	APIVersion    string
}

type AuditEntryDAO

type AuditEntryDAO interface {
	Create(ctx context.Context, tx *db.Tx, entry AuditEntryCreateInput) (*AuditEntry, error)
	Update(ctx context.Context, tx *db.Tx, input AuditEntryUpdateInput) (*AuditEntry, error)
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID) (*AuditEntry, error)
	GetAll(ctx context.Context, tx *db.Tx, filter AuditEntryFilterInput, page paginator.PageInput) ([]AuditEntry, int, error)
}

func NewAuditEntryDAO

func NewAuditEntryDAO(dbSession *db.Session) AuditEntryDAO

type AuditEntryFilterInput

type AuditEntryFilterInput struct {
	OrgName    *string
	FailedOnly *bool // returns only entries with status_code >= 400
}

type AuditEntrySQLDAO

type AuditEntrySQLDAO struct {
	AuditEntryDAO
	// contains filtered or unexported fields
}

AuditEntrySQLDAO is the SQL data access object for AuditEntry

func (AuditEntrySQLDAO) Create

func (aed AuditEntrySQLDAO) Create(ctx context.Context, tx *db.Tx, input AuditEntryCreateInput) (*AuditEntry, error)

Create creates an AuditEntry from the given parameters

func (AuditEntrySQLDAO) GetAll

func (AuditEntrySQLDAO) GetByID

func (aed AuditEntrySQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID) (*AuditEntry, error)

func (AuditEntrySQLDAO) Update

func (aed AuditEntrySQLDAO) Update(ctx context.Context, tx *db.Tx, input AuditEntryUpdateInput) (*AuditEntry, error)

type AuditEntryUpdateInput

type AuditEntryUpdateInput struct {
	ID            uuid.UUID
	StatusMessage *string
	Body          map[string]interface{}
	ExtraData     map[string]interface{}
}

type Domain

type Domain struct {
	bun.BaseModel `bun:"table:domain,alias:d"`

	ID                 uuid.UUID  `bun:"type:uuid,pk"`
	Hostname           string     `bun:"hostname,notnull"`
	Org                string     `bun:"org,notnull"`
	ControllerDomainID *uuid.UUID `bun:"controller_domain_id,type:uuid"`
	Status             string     `bun:"status,notnull"`
	Created            time.Time  `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated            time.Time  `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted            *time.Time `bun:"deleted,soft_delete"`
	CreatedBy          uuid.UUID  `bun:"type:uuid,notnull"`
}

Domain contains information about the fully qualified domain name for determining machine hostnames

func (*Domain) BeforeAppendModel

func (d *Domain) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

type DomainDAO

type DomainDAO interface {
	//
	CreateFromParams(ctx context.Context, tx *db.Tx, hostname string, org string, controllerDomainID *uuid.UUID, status string, createdBy uuid.UUID) (*Domain, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Domain, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, hostname, org *string, controllerDomainID *uuid.UUID, status *string, includeRelations []string) ([]Domain, error)
	//
	UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, hostname *string, org *string, controllerDomainID *uuid.UUID, status *string) (*Domain, error)
	//
	ClearFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, controllerDomainID bool) (*Domain, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

DomainDAO is an interface for interacting with the Domain model

func NewDomainDAO

func NewDomainDAO(dbSession *db.Session) DomainDAO

NewDomainDAO returns a new DomainDAO

type DomainSQLDAO

type DomainSQLDAO struct {
	DomainDAO
	// contains filtered or unexported fields
}

DomainSQLDAO is an implementation of the DomainDAO interface

func (DomainSQLDAO) ClearFromParams

func (dsd DomainSQLDAO) ClearFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, controllerDomainID bool) (*Domain, error)

ClearFromParams sets parameters of an existing Domain to null values in db parameter controllerDomainID when true, the are set to null in db since there are 2 operations (UPDATE, SELECT), it is required that this must be within a transaction

func (DomainSQLDAO) CreateFromParams

func (dsd DomainSQLDAO) CreateFromParams(
	ctx context.Context, tx *db.Tx,
	hostname string,
	org string,
	controllerDomainID *uuid.UUID,
	status string, createdBy uuid.UUID) (*Domain, error)

CreateFromParams creates a new Domain from the given parameters since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (DomainSQLDAO) DeleteByID

func (dsd DomainSQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error

DeleteByID deletes an Domain by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (DomainSQLDAO) GetAll

func (dsd DomainSQLDAO) GetAll(ctx context.Context, tx *db.Tx, hostname, org *string, controllerDomainID *uuid.UUID, status *string, includeRelations []string) ([]Domain, error)

GetAll returns all Domains Optional filters can be specified on hostname, org, controllerDomainID errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0

func (DomainSQLDAO) GetByID

func (dsd DomainSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Domain, error)

GetByID returns a Domain by ID currently returns error if the record is not found or if there is any db error TBD: to distinguish not found from db related errors to help application logic to be precise

func (DomainSQLDAO) UpdateFromParams

func (dsd DomainSQLDAO) UpdateFromParams(
	ctx context.Context, tx *db.Tx,
	id uuid.UUID,
	hostname *string,
	org *string,
	controllerDomainID *uuid.UUID,
	status *string) (*Domain, error)

UpdateFromParams updates specified fields of an existing Domain The updated fields are assumed to be set to non-null values For setting to null values, use: ClearFromParams since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

type DpuExtensionService

type DpuExtensionService struct {
	bun.BaseModel `bun:"table:dpu_extension_service,alias:des"`

	ID              uuid.UUID                       `bun:"id,type:uuid,unique,pk"`
	Name            string                          `bun:"name,notnull"`
	Description     *string                         `bun:"description"`
	ServiceType     string                          `bun:"service_type,notnull"`
	SiteID          uuid.UUID                       `bun:"site_id,type:uuid,notnull,pk"`
	Site            *Site                           `bun:"rel:belongs-to,join:site_id=id"`
	TenantID        uuid.UUID                       `bun:"tenant_id,type:uuid,notnull"`
	Tenant          *Tenant                         `bun:"rel:belongs-to,join:tenant_id=id"`
	Version         *string                         `bun:"version"`
	VersionInfo     *DpuExtensionServiceVersionInfo `bun:"version_info,type:jsonb"`
	ActiveVersions  []string                        `bun:"active_versions,type:text[],default:'{}'"`
	Status          string                          `bun:"status,notnull"`
	IsMissingOnSite bool                            `bun:"is_missing_on_site,notnull,default:false"`
	Created         time.Time                       `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated         time.Time                       `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted         time.Time                       `bun:"deleted,nullzero,default:null"`
	CreatedBy       uuid.UUID                       `bun:"created_by,type:uuid,notnull"`
}

DpuExtensionService represents a DPU extension service

func (*DpuExtensionService) BeforeAppendModel

func (des *DpuExtensionService) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*DpuExtensionService) BeforeCreateTable

func (des *DpuExtensionService) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type DpuExtensionServiceClearInput

type DpuExtensionServiceClearInput struct {
	DpuExtensionServiceID uuid.UUID
	Description           bool
	Version               bool
	VersionInfo           bool
}

DpuExtensionServiceClearInput is used to clear a DpuExtensionService object

type DpuExtensionServiceCreateInput

type DpuExtensionServiceCreateInput struct {
	DpuExtensionServiceID *uuid.UUID
	Name                  string
	Description           *string
	ServiceType           string
	SiteID                uuid.UUID
	TenantID              uuid.UUID
	Version               *string
	VersionInfo           *DpuExtensionServiceVersionInfo
	ActiveVersions        []string
	Status                string
	CreatedBy             uuid.UUID
}

DpuExtensionServiceCreateInput is used to create a new DpuExtensionService

type DpuExtensionServiceDAO

type DpuExtensionServiceDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input DpuExtensionServiceCreateInput) (*DpuExtensionService, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*DpuExtensionService, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter DpuExtensionServiceFilterInput, page paginator.PageInput, includeRelations []string) ([]DpuExtensionService, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input DpuExtensionServiceUpdateInput) (*DpuExtensionService, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input DpuExtensionServiceClearInput) (*DpuExtensionService, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

DpuExtensionServiceDAO is an interface for interacting with the DpuExtensionService model

func NewDpuExtensionServiceDAO

func NewDpuExtensionServiceDAO(dbSession *db.Session) DpuExtensionServiceDAO

NewDpuExtensionServiceDAO returns a new DpuExtensionServiceDAO

type DpuExtensionServiceDeployment

type DpuExtensionServiceDeployment struct {
	bun.BaseModel `bun:"table:dpu_extension_service_deployment,alias:desd"`

	ID                    uuid.UUID            `bun:"id,type:uuid,unique,pk"`
	SiteID                uuid.UUID            `bun:"site_id,type:uuid,notnull,pk"`
	Site                  *Site                `bun:"rel:belongs-to,join:site_id=id"`
	TenantID              uuid.UUID            `bun:"tenant_id,type:uuid,notnull"`
	Tenant                *Tenant              `bun:"rel:belongs-to,join:tenant_id=id"`
	InstanceID            uuid.UUID            `bun:"instance_id,type:uuid,notnull"`
	Instance              *Instance            `bun:"rel:belongs-to,join:instance_id=id"`
	DpuExtensionServiceID uuid.UUID            `bun:"dpu_extension_service_id,type:uuid,notnull"`
	DpuExtensionService   *DpuExtensionService `bun:"rel:belongs-to,join:dpu_extension_service_id=id"`
	Version               string               `bun:"version"`
	Status                string               `bun:"status,notnull"`
	Created               time.Time            `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated               time.Time            `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted               *time.Time           `bun:"deleted,soft_delete"`
	CreatedBy             uuid.UUID            `bun:"created_by,type:uuid,notnull"`
}

DpuExtensionServiceDeployment represents a DPU extension service deployment

func (*DpuExtensionServiceDeployment) BeforeAppendModel

func (desd *DpuExtensionServiceDeployment) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*DpuExtensionServiceDeployment) BeforeCreateTable

func (desd *DpuExtensionServiceDeployment) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type DpuExtensionServiceDeploymentCreateInput

type DpuExtensionServiceDeploymentCreateInput struct {
	DpuExtensionServiceDeploymentID *uuid.UUID
	SiteID                          uuid.UUID
	TenantID                        uuid.UUID
	InstanceID                      uuid.UUID
	DpuExtensionServiceID           uuid.UUID
	Version                         string
	Status                          string
	CreatedBy                       uuid.UUID
}

DpuExtensionServiceDeploymentCreateInput is used to create a new DpuExtensionServiceDeployment

type DpuExtensionServiceDeploymentDAO

type DpuExtensionServiceDeploymentDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input DpuExtensionServiceDeploymentCreateInput) (*DpuExtensionServiceDeployment, error)
	//
	CreateMultiple(ctx context.Context, tx *db.Tx, inputs []DpuExtensionServiceDeploymentCreateInput) ([]DpuExtensionServiceDeployment, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*DpuExtensionServiceDeployment, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter DpuExtensionServiceDeploymentFilterInput, page paginator.PageInput, includeRelations []string) ([]DpuExtensionServiceDeployment, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input DpuExtensionServiceDeploymentUpdateInput) (*DpuExtensionServiceDeployment, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

DpuExtensionServiceDeploymentDAO is an interface for interacting with the DpuExtensionServiceDeployment model

func NewDpuExtensionServiceDeploymentDAO

func NewDpuExtensionServiceDeploymentDAO(dbSession *db.Session) DpuExtensionServiceDeploymentDAO

NewDpuExtensionServiceDeploymentDAO returns a new DpuExtensionServiceDeploymentDAO

type DpuExtensionServiceDeploymentFilterInput

type DpuExtensionServiceDeploymentFilterInput struct {
	DpuExtensionServiceDeploymentIDs []uuid.UUID
	SiteIDs                          []uuid.UUID
	TenantIDs                        []uuid.UUID
	InstanceIDs                      []uuid.UUID
	DpuExtensionServiceIDs           []uuid.UUID
	Versions                         []string
	Statuses                         []string
	SearchQuery                      *string
}

DpuExtensionServiceDeploymentFilterInput is used to filter the DpuExtensionServiceDeployment objects

type DpuExtensionServiceDeploymentSQLDAO

type DpuExtensionServiceDeploymentSQLDAO struct {
	DpuExtensionServiceDeploymentDAO
	// contains filtered or unexported fields
}

DpuExtensionServiceDeploymentSQLDAO is an implementation of the DpuExtensionServiceDeploymentDAO interface

func (DpuExtensionServiceDeploymentSQLDAO) Create

Create creates a new DpuExtensionServiceDeployment

func (DpuExtensionServiceDeploymentSQLDAO) CreateMultiple

CreateMultiple creates multiple DpuExtensionServiceDeployments

func (DpuExtensionServiceDeploymentSQLDAO) Delete

func (desdsd DpuExtensionServiceDeploymentSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes a DpuExtensionServiceDeployment by ID error is returned only if there is a db error if the object being deleted doesn't exist, error is not returned

func (DpuExtensionServiceDeploymentSQLDAO) GetAll

GetAll returns all DpuExtensionServiceDeployments with filtering and pagination errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if page.OrderBy is nil, then records are ordered by column specified in DpuExtensionServiceDeploymentOrderByDefault in ascending order

func (DpuExtensionServiceDeploymentSQLDAO) GetByID

func (desdsd DpuExtensionServiceDeploymentSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*DpuExtensionServiceDeployment, error)

GetByID returns a DpuExtensionServiceDeployment by ID returns db.ErrDoesNotExist error if the record is not found

func (DpuExtensionServiceDeploymentSQLDAO) Update

Update updates specified fields of an existing DpuExtensionServiceDeployment The updated fields are assumed to be set to non-null values

type DpuExtensionServiceDeploymentUpdateInput

type DpuExtensionServiceDeploymentUpdateInput struct {
	DpuExtensionServiceDeploymentID uuid.UUID
	Status                          *string
}

DpuExtensionServiceDeploymentUpdateInput is used to update a DpuExtensionServiceDeployment object

type DpuExtensionServiceFilterInput

type DpuExtensionServiceFilterInput struct {
	DpuExtensionServiceIDs []uuid.UUID
	Names                  []string
	ServiceTypes           []string
	SiteIDs                []uuid.UUID
	TenantIDs              []uuid.UUID
	Versions               []string
	Statuses               []string
	SearchQuery            *string
}

DpuExtensionServiceFilterInput is used to filter the DpuExtensionService objects

type DpuExtensionServiceObservability

type DpuExtensionServiceObservability struct {
	*cwssaws.DpuExtensionServiceObservability
}

A light wrapper around the protobuf so that we can implement our own marshal/unmarshal that understands how to work with protobuf messages

func (*DpuExtensionServiceObservability) MarshalJSON

func (o *DpuExtensionServiceObservability) MarshalJSON() ([]byte, error)

func (*DpuExtensionServiceObservability) UnmarshalJSON

func (o *DpuExtensionServiceObservability) UnmarshalJSON(b []byte) error

type DpuExtensionServiceSQLDAO

type DpuExtensionServiceSQLDAO struct {
	DpuExtensionServiceDAO
	// contains filtered or unexported fields
}

DpuExtensionServiceSQLDAO is an implementation of the DpuExtensionServiceDAO interface

func (DpuExtensionServiceSQLDAO) Clear

Clear clears the specified fields of a DpuExtensionService object

func (DpuExtensionServiceSQLDAO) Create

Create creates a new DpuExtensionService

func (DpuExtensionServiceSQLDAO) Delete

func (dessd DpuExtensionServiceSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes a DpuExtensionService by ID error is returned only if there is a db error if the object being deleted doesn't exist, error is not returned

func (DpuExtensionServiceSQLDAO) GetAll

func (dessd DpuExtensionServiceSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter DpuExtensionServiceFilterInput, page paginator.PageInput, includeRelations []string) ([]DpuExtensionService, int, error)

GetAll returns all DpuExtensionServices with filtering and pagination errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if page.OrderBy is nil, then records are ordered by column specified in DpuExtensionServiceOrderByDefault in ascending order

func (DpuExtensionServiceSQLDAO) GetByID

func (dessd DpuExtensionServiceSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*DpuExtensionService, error)

GetByID returns a DpuExtensionService by ID and SiteID returns db.ErrDoesNotExist error if the record is not found

func (DpuExtensionServiceSQLDAO) Update

Update updates specified fields of an existing DpuExtensionService The updated fields are assumed to be set to non-null values

type DpuExtensionServiceUpdateInput

type DpuExtensionServiceUpdateInput struct {
	DpuExtensionServiceID uuid.UUID
	Name                  *string
	Description           *string
	Version               *string
	VersionInfo           *DpuExtensionServiceVersionInfo
	ActiveVersions        []string
	Status                *string
	IsMissingOnSite       *bool
}

DpuExtensionServiceUpdateInput is used to update a DpuExtensionService object

type DpuExtensionServiceVersionInfo

type DpuExtensionServiceVersionInfo struct {
	Version        string                            `json:"version"`
	Data           string                            `json:"data"`
	HasCredentials bool                              `json:"has_credentials"`
	Created        time.Time                         `json:"created"`
	Observability  *DpuExtensionServiceObservability `json:"observability,omitempty"`
}

DpuExtensionServiceVersionInfo is a data structure to capture information for a specific DPU Extension Service version

func (*DpuExtensionServiceVersionInfo) FromProto

func (vi *DpuExtensionServiceVersionInfo) FromProto(protoVersionInfo *cwssaws.DpuExtensionServiceVersionInfo, fallbackTime time.Time)

FromProto populates version info from the site-agent protobuf form.

type ExpectedMachine

type ExpectedMachine struct {
	bun.BaseModel `bun:"table:expected_machine,alias:em"`

	ID                       uuid.UUID `bun:"id,pk"`
	SiteID                   uuid.UUID `bun:"site_id,type:uuid,notnull"`
	Site                     *Site     `bun:"rel:belongs-to,join:site_id=id"`
	BmcMacAddress            string    `bun:"bmc_mac_address,notnull"`
	ChassisSerialNumber      string    `bun:"chassis_serial_number,notnull"`
	SkuID                    *string   `bun:"sku_id"`
	Sku                      *SKU      `bun:"rel:belongs-to,join:sku_id=id"`
	MachineID                *string   `bun:"machine_id"`
	Machine                  *Machine  `bun:"rel:belongs-to,join:machine_id=id"`
	FallbackDpuSerialNumbers []string  `bun:"fallback_dpu_serial_numbers,array"`
	BmcIpAddress             *string   `bun:"bmc_ip_address"`
	RackID                   *string   `bun:"rack_id"`
	Name                     *string   `bun:"name"`
	Manufacturer             *string   `bun:"manufacturer"`
	Model                    *string   `bun:"model"`
	Description              *string   `bun:"description"`
	FirmwareVersion          *string   `bun:"firmware_version"`
	SlotID                   *int32    `bun:"slot_id"`
	TrayIdx                  *int32    `bun:"tray_idx"`
	HostID                   *int32    `bun:"host_id"`
	Labels                   Labels    `bun:"labels,type:jsonb"`
	Created                  time.Time `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                  time.Time `bun:"updated,nullzero,notnull,default:current_timestamp"`
	CreatedBy                uuid.UUID `bun:"type:uuid,notnull"`
}

ExpectedMachine is a record for each bare-metal host expected to be processed by NICo

func (*ExpectedMachine) BeforeAppendModel

func (em *ExpectedMachine) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*ExpectedMachine) BeforeCreateTable

func (em *ExpectedMachine) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created This is only used in tests

func (*ExpectedMachine) FromProto

func (em *ExpectedMachine) FromProto(proto *cwssaws.ExpectedMachine, linkedMachineID *string)

FromProto populates this ExpectedMachine from a workflow proto reported by a Site. linkedMachineID, when non-nil, is the ID of the Machine matched by BmcMacAddress (resolved by the caller from a separate lookup table). A nil proto is a no-op. An invalid or missing proto.Id leaves em.ID unchanged so the caller can validate the proto's UUID before calling.

func (*ExpectedMachine) ToProto

ToProto builds the workflow proto for this ExpectedMachine. BMC credentials are passed in because they aren't persisted on the record; labels are read from em.Labels.

type ExpectedMachineClearInput

type ExpectedMachineClearInput struct {
	ExpectedMachineID        uuid.UUID
	SkuID                    bool
	MachineID                bool
	FallbackDpuSerialNumbers bool
	BmcIpAddress             bool
	RackID                   bool
	Name                     bool
	Manufacturer             bool
	Model                    bool
	Description              bool
	FirmwareVersion          bool
	SlotID                   bool
	TrayIdx                  bool
	HostID                   bool
	Labels                   bool
}

ExpectedMachineClearInput input parameters for Clear method

type ExpectedMachineCreateInput

type ExpectedMachineCreateInput struct {
	ExpectedMachineID        uuid.UUID
	SiteID                   uuid.UUID
	BmcMacAddress            string
	ChassisSerialNumber      string
	SkuID                    *string
	MachineID                *string
	FallbackDpuSerialNumbers []string
	BmcIpAddress             *string
	RackID                   *string
	Name                     *string
	Manufacturer             *string
	Model                    *string
	Description              *string
	FirmwareVersion          *string
	SlotID                   *int32
	TrayIdx                  *int32
	HostID                   *int32
	Labels                   map[string]string
	CreatedBy                uuid.UUID
}

ExpectedMachineCreateInput input parameters for Create method

type ExpectedMachineCredentials

type ExpectedMachineCredentials struct {
	Username *string
	Password *string
}

ExpectedMachineCredentials carries the BMC credentials for one ExpectedMachine. They live in their own type because they aren't stored in the DB record and have to be threaded through to ToProto separately.

type ExpectedMachineDAO

type ExpectedMachineDAO interface {
	// Create used to create new row
	Create(ctx context.Context, tx *db.Tx, input ExpectedMachineCreateInput) (*ExpectedMachine, error)
	// CreateMultiple used to create multiple rows
	CreateMultiple(ctx context.Context, tx *db.Tx, inputs []ExpectedMachineCreateInput) ([]ExpectedMachine, error)
	// Update used to update row
	Update(ctx context.Context, tx *db.Tx, input ExpectedMachineUpdateInput) (*ExpectedMachine, error)
	// UpdateMultiple used to update multiple rows
	UpdateMultiple(ctx context.Context, tx *db.Tx, inputs []ExpectedMachineUpdateInput) ([]ExpectedMachine, error)
	// Delete used to delete row
	Delete(ctx context.Context, tx *db.Tx, expectedMachineID uuid.UUID) error
	// Clear used to clear fields in the row
	Clear(ctx context.Context, tx *db.Tx, input ExpectedMachineClearInput) (*ExpectedMachine, error)
	// GetAll returns all the rows based on the filter and page inputs
	GetAll(ctx context.Context, tx *db.Tx, filter ExpectedMachineFilterInput, page paginator.PageInput, includeRelations []string) ([]ExpectedMachine, int, error)
	// Get returns row for specified ID
	Get(ctx context.Context, tx *db.Tx, expectedMachineID uuid.UUID, includeRelations []string, forUpdate bool) (*ExpectedMachine, error)
}

ExpectedMachineDAO is an interface for interacting with the ExpectedMachine model

func NewExpectedMachineDAO

func NewExpectedMachineDAO(dbSession *db.Session) ExpectedMachineDAO

NewExpectedMachineDAO returns a new ExpectedMachineDAO

type ExpectedMachineFilterInput

type ExpectedMachineFilterInput struct {
	ExpectedMachineIDs   []uuid.UUID
	SiteIDs              []uuid.UUID
	BmcMacAddresses      []string
	ChassisSerialNumbers []string
	SkuIDs               []string
	MachineIDs           []string
	SearchQuery          *string
}

ExpectedMachineFilterInput filtering options for GetAll method

type ExpectedMachineSQLDAO

type ExpectedMachineSQLDAO struct {
	ExpectedMachineDAO
	// contains filtered or unexported fields
}

ExpectedMachineSQLDAO is an implementation of the ExpectedMachineDAO interface

func (ExpectedMachineSQLDAO) Clear

Clear sets parameters of an existing ExpectedMachine to null values in db

func (ExpectedMachineSQLDAO) Create

Create creates a new ExpectedMachine from the given parameters The returned ExpectedMachine will not have any related structs filled in. Since there are 2 operations (INSERT, SELECT), it is required that this library call happens within a transaction

func (ExpectedMachineSQLDAO) CreateMultiple

func (emsd ExpectedMachineSQLDAO) CreateMultiple(ctx context.Context, tx *db.Tx, inputs []ExpectedMachineCreateInput) ([]ExpectedMachine, error)

CreateMultiple creates multiple ExpectedMachines from the given parameters The returned ExpectedMachines will not have any related structs filled in. Since there are 2 operations (INSERT, SELECT), it is required that this library call happens within a transaction

func (ExpectedMachineSQLDAO) Delete

func (emsd ExpectedMachineSQLDAO) Delete(ctx context.Context, tx *db.Tx, expectedMachineID uuid.UUID) error

Delete deletes an ExpectedMachine by ID Error is returned only if there is a db error

func (ExpectedMachineSQLDAO) Get

func (emsd ExpectedMachineSQLDAO) Get(ctx context.Context, tx *db.Tx, expectedMachineID uuid.UUID, includeRelations []string, forUpdate bool) (*ExpectedMachine, error)

Get returns an ExpectedMachine by ID returns db.ErrDoesNotExist error if the record is not found

func (ExpectedMachineSQLDAO) GetAll

func (emsd ExpectedMachineSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter ExpectedMachineFilterInput, page paginator.PageInput, includeRelations []string) ([]ExpectedMachine, int, error)

GetAll returns all ExpectedMachines based on the filter and paging Errors are returned only when there is a db related error If records not found, then error is nil, but length of returned slice is 0 If orderBy is nil, then records are ordered by column specified in ExpectedMachineOrderByDefault in ascending order

func (ExpectedMachineSQLDAO) Update

Update updates specified fields of an existing ExpectedMachine The updated fields are assumed to be set to non-null values For setting to null values, use: Clear since there are 2 operations (UPDATE, SELECT), it is required that this library call happens within a transaction

func (ExpectedMachineSQLDAO) UpdateMultiple

func (emsd ExpectedMachineSQLDAO) UpdateMultiple(ctx context.Context, tx *db.Tx, inputs []ExpectedMachineUpdateInput) ([]ExpectedMachine, error)

UpdateMultiple updates multiple ExpectedMachines with the given parameters using a single bulk UPDATE query All inputs should update the same set of fields for optimal performance The updated fields are assumed to be set to non-null values. Since there are 2 operations (UPDATE, SELECT), it is required that this library call happens within a transaction

type ExpectedMachineUpdateInput

type ExpectedMachineUpdateInput struct {
	ExpectedMachineID        uuid.UUID
	BmcMacAddress            *string
	ChassisSerialNumber      *string
	SkuID                    *string
	MachineID                *string
	FallbackDpuSerialNumbers []string
	BmcIpAddress             *string
	RackID                   *string
	Name                     *string
	Manufacturer             *string
	Model                    *string
	Description              *string
	FirmwareVersion          *string
	SlotID                   *int32
	TrayIdx                  *int32
	HostID                   *int32
	Labels                   map[string]string
}

ExpectedMachineUpdateInput input parameters for Update method

type ExpectedPowerShelf

type ExpectedPowerShelf struct {
	bun.BaseModel `bun:"table:expected_power_shelf,alias:eps"`

	ID                uuid.UUID `bun:"id,pk"`
	SiteID            uuid.UUID `bun:"site_id,type:uuid,notnull"`
	Site              *Site     `bun:"rel:belongs-to,join:site_id=id"`
	BmcMacAddress     string    `bun:"bmc_mac_address,notnull"`
	ShelfSerialNumber string    `bun:"shelf_serial_number,notnull"`
	BmcIpAddress      *string   `bun:"bmc_ip_address"`
	RackID            *string   `bun:"rack_id"`
	Name              *string   `bun:"name"`
	Manufacturer      *string   `bun:"manufacturer"`
	Model             *string   `bun:"model"`
	Description       *string   `bun:"description"`
	FirmwareVersion   *string   `bun:"firmware_version"`
	SlotID            *int32    `bun:"slot_id"`
	TrayIdx           *int32    `bun:"tray_idx"`
	HostID            *int32    `bun:"host_id"`
	Labels            Labels    `bun:"labels,type:jsonb"`
	Created           time.Time `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated           time.Time `bun:"updated,nullzero,notnull,default:current_timestamp"`
	CreatedBy         uuid.UUID `bun:"type:uuid,notnull"`
}

ExpectedPowerShelf is a record for each power shelf expected to be processed by NICo

func (*ExpectedPowerShelf) BeforeAppendModel

func (eps *ExpectedPowerShelf) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*ExpectedPowerShelf) BeforeCreateTable

func (eps *ExpectedPowerShelf) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created This is only used in tests

func (*ExpectedPowerShelf) FromProto

func (eps *ExpectedPowerShelf) FromProto(proto *cwssaws.ExpectedPowerShelf)

FromProto populates this ExpectedPowerShelf from a workflow proto reported by a Site. A nil proto is a no-op. An invalid or missing proto.ExpectedPowerShelfId leaves eps.ID unchanged so the caller can validate the proto's UUID before calling.

func (*ExpectedPowerShelf) ToProto

ToProto builds the workflow proto for this ExpectedPowerShelf. BMC credentials are passed in because they aren't persisted on the record; labels are read from eps.Labels.

type ExpectedPowerShelfClearInput

type ExpectedPowerShelfClearInput struct {
	ExpectedPowerShelfID uuid.UUID
	BmcIpAddress         bool
	RackID               bool
	Name                 bool
	Manufacturer         bool
	Model                bool
	Description          bool
	FirmwareVersion      bool
	SlotID               bool
	TrayIdx              bool
	HostID               bool
	Labels               bool
}

ExpectedPowerShelfClearInput input parameters for Clear method

type ExpectedPowerShelfCreateInput

type ExpectedPowerShelfCreateInput struct {
	ExpectedPowerShelfID uuid.UUID
	SiteID               uuid.UUID
	BmcMacAddress        string
	ShelfSerialNumber    string
	BmcIpAddress         *string
	RackID               *string
	Name                 *string
	Manufacturer         *string
	Model                *string
	Description          *string
	FirmwareVersion      *string
	SlotID               *int32
	TrayIdx              *int32
	HostID               *int32
	Labels               map[string]string
	CreatedBy            uuid.UUID
}

ExpectedPowerShelfCreateInput input parameters for Create method

type ExpectedPowerShelfCredentials

type ExpectedPowerShelfCredentials struct {
	Username *string
	Password *string
}

ExpectedPowerShelfCredentials carries the BMC credentials for one ExpectedPowerShelf. They live in their own type because they aren't stored in the DB record and have to be threaded through to ToProto separately.

type ExpectedPowerShelfDAO

type ExpectedPowerShelfDAO interface {
	// Create used to create new row
	Create(ctx context.Context, tx *db.Tx, input ExpectedPowerShelfCreateInput) (*ExpectedPowerShelf, error)
	// Update used to update row
	Update(ctx context.Context, tx *db.Tx, input ExpectedPowerShelfUpdateInput) (*ExpectedPowerShelf, error)
	// Delete used to delete row
	Delete(ctx context.Context, tx *db.Tx, expectedPowerShelfID uuid.UUID) error
	// Clear used to clear fields in the row
	Clear(ctx context.Context, tx *db.Tx, input ExpectedPowerShelfClearInput) (*ExpectedPowerShelf, error)
	// GetAll returns all the rows based on the filter and page inputs
	GetAll(ctx context.Context, tx *db.Tx, filter ExpectedPowerShelfFilterInput, page paginator.PageInput, includeRelations []string) ([]ExpectedPowerShelf, int, error)
	// Get returns row for specified ID
	Get(ctx context.Context, tx *db.Tx, expectedPowerShelfID uuid.UUID, includeRelations []string, forUpdate bool) (*ExpectedPowerShelf, error)
}

ExpectedPowerShelfDAO is an interface for interacting with the ExpectedPowerShelf model

func NewExpectedPowerShelfDAO

func NewExpectedPowerShelfDAO(dbSession *db.Session) ExpectedPowerShelfDAO

NewExpectedPowerShelfDAO returns a new ExpectedPowerShelfDAO

type ExpectedPowerShelfFilterInput

type ExpectedPowerShelfFilterInput struct {
	ExpectedPowerShelfIDs []uuid.UUID
	SiteIDs               []uuid.UUID
	BmcMacAddresses       []string
	ShelfSerialNumbers    []string
	SearchQuery           *string
}

ExpectedPowerShelfFilterInput filtering options for GetAll method

type ExpectedPowerShelfSQLDAO

type ExpectedPowerShelfSQLDAO struct {
	ExpectedPowerShelfDAO
	// contains filtered or unexported fields
}

ExpectedPowerShelfSQLDAO is an implementation of the ExpectedPowerShelfDAO interface

func (ExpectedPowerShelfSQLDAO) Clear

Clear sets parameters of an existing ExpectedPowerShelf to null values in db

func (ExpectedPowerShelfSQLDAO) Create

Create creates a new ExpectedPowerShelf from the given parameters The returned ExpectedPowerShelf will not have any related structs filled in. Since there are 2 operations (INSERT, SELECT), it is required that this library call happens within a transaction

func (ExpectedPowerShelfSQLDAO) Delete

func (epsd ExpectedPowerShelfSQLDAO) Delete(ctx context.Context, tx *db.Tx, expectedPowerShelfID uuid.UUID) error

Delete deletes an ExpectedPowerShelf by ID Error is returned only if there is a db error

func (ExpectedPowerShelfSQLDAO) Get

func (epsd ExpectedPowerShelfSQLDAO) Get(ctx context.Context, tx *db.Tx, expectedPowerShelfID uuid.UUID, includeRelations []string, forUpdate bool) (*ExpectedPowerShelf, error)

Get returns an ExpectedPowerShelf by ID returns db.ErrDoesNotExist error if the record is not found

func (ExpectedPowerShelfSQLDAO) GetAll

func (epsd ExpectedPowerShelfSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter ExpectedPowerShelfFilterInput, page paginator.PageInput, includeRelations []string) ([]ExpectedPowerShelf, int, error)

GetAll returns all ExpectedPowerShelves based on the filter and paging Errors are returned only when there is a db related error If records not found, then error is nil, but length of returned slice is 0 If orderBy is nil, then records are ordered by column specified in ExpectedPowerShelfOrderByDefault in ascending order

func (ExpectedPowerShelfSQLDAO) Update

Update updates specified fields of an existing ExpectedPowerShelf The updated fields are assumed to be set to non-null values For setting to null values, use: Clear since there are 2 operations (UPDATE, SELECT), it is required that this library call happens within a transaction

type ExpectedPowerShelfUpdateInput

type ExpectedPowerShelfUpdateInput struct {
	ExpectedPowerShelfID uuid.UUID
	BmcMacAddress        *string
	ShelfSerialNumber    *string
	BmcIpAddress         *string
	RackID               *string
	Name                 *string
	Manufacturer         *string
	Model                *string
	Description          *string
	FirmwareVersion      *string
	SlotID               *int32
	TrayIdx              *int32
	HostID               *int32
	Labels               map[string]string
}

ExpectedPowerShelfUpdateInput input parameters for Update method

type ExpectedRack

type ExpectedRack struct {
	bun.BaseModel `bun:"table:expected_rack,alias:er"`

	ID            uuid.UUID `bun:"id,pk"`
	SiteID        uuid.UUID `bun:"site_id,type:uuid,notnull"`
	Site          *Site     `bun:"rel:belongs-to,join:site_id=id"`
	RackID        string    `bun:"rack_id,notnull"`
	RackProfileID string    `bun:"rack_profile_id,notnull"`
	Name          string    `bun:"name,nullzero,notnull,default:''"`
	Description   string    `bun:"description,nullzero,notnull,default:''"`
	Labels        Labels    `bun:"labels,type:jsonb,nullzero,notnull,default:'{}'"`
	Created       time.Time `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated       time.Time `bun:"updated,nullzero,notnull,default:current_timestamp"`
	CreatedBy     uuid.UUID `bun:"type:uuid,notnull"`
}

ExpectedRack is a record for each rack expected to be processed by NICo

func (*ExpectedRack) BeforeAppendModel

func (er *ExpectedRack) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*ExpectedRack) BeforeCreateTable

func (er *ExpectedRack) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created This is only used in tests

func (*ExpectedRack) FromProto

func (er *ExpectedRack) FromProto(proto *cwssaws.ExpectedRack)

FromProto populates this ExpectedRack from a workflow proto reported by a Site. ExpectedRacks are identified across systems by the operator-supplied RackID string carried in proto.RackId; the DB-side uuid.UUID `er.ID` is not on the proto and is set by the caller. A nil proto is a no-op. A nil or empty proto.RackId leaves er.RackID unchanged so the caller can validate the proto identifier before calling.

func (*ExpectedRack) ToProto

func (er *ExpectedRack) ToProto() *cwssaws.ExpectedRack

ToProto builds the workflow proto for this ExpectedRack from the persisted DB record. ExpectedRacks have no BMC credentials, so no extra arguments are needed.

type ExpectedRackCreateInput

type ExpectedRackCreateInput struct {
	ExpectedRackID uuid.UUID
	SiteID         uuid.UUID
	RackID         string
	RackProfileID  string
	Name           string
	Description    string
	Labels         map[string]string
	CreatedBy      uuid.UUID
}

ExpectedRackCreateInput input parameters for Create method

type ExpectedRackDAO

type ExpectedRackDAO interface {
	// Create used to create a new row
	Create(ctx context.Context, tx *db.Tx, input ExpectedRackCreateInput) (*ExpectedRack, error)
	// CreateMultiple used to create multiple rows
	CreateMultiple(ctx context.Context, tx *db.Tx, inputs []ExpectedRackCreateInput) ([]ExpectedRack, error)
	// Update used to update a row
	Update(ctx context.Context, tx *db.Tx, input ExpectedRackUpdateInput) (*ExpectedRack, error)
	// UpdateMultiple used to update multiple rows
	UpdateMultiple(ctx context.Context, tx *db.Tx, inputs []ExpectedRackUpdateInput) ([]ExpectedRack, error)
	// Delete used to delete a row
	Delete(ctx context.Context, tx *db.Tx, expectedRackID uuid.UUID) error
	// DeleteAll used to delete all rows (optionally scoped by site)
	DeleteAll(ctx context.Context, tx *db.Tx, filter ExpectedRackFilterInput) error
	// ReplaceAll deletes all rows matching the filter then creates new ones
	ReplaceAll(ctx context.Context, tx *db.Tx, filter ExpectedRackFilterInput, inputs []ExpectedRackCreateInput) ([]ExpectedRack, error)
	// GetAll returns all the rows based on the filter and page inputs
	GetAll(ctx context.Context, tx *db.Tx, filter ExpectedRackFilterInput, page paginator.PageInput, includeRelations []string) ([]ExpectedRack, int, error)
	// Get returns row for the specified ID
	Get(ctx context.Context, tx *db.Tx, expectedRackID uuid.UUID, includeRelations []string, forUpdate bool) (*ExpectedRack, error)
}

ExpectedRackDAO is an interface for interacting with the ExpectedRack model

func NewExpectedRackDAO

func NewExpectedRackDAO(dbSession *db.Session) ExpectedRackDAO

NewExpectedRackDAO returns a new ExpectedRackDAO

type ExpectedRackFilterInput

type ExpectedRackFilterInput struct {
	ExpectedRackIDs []uuid.UUID
	RackIDs         []string
	SiteIDs         []uuid.UUID
	RackProfileIDs  []string
	SearchQuery     *string
}

ExpectedRackFilterInput filtering options for GetAll method

type ExpectedRackSQLDAO

type ExpectedRackSQLDAO struct {
	ExpectedRackDAO
	// contains filtered or unexported fields
}

ExpectedRackSQLDAO is an implementation of the ExpectedRackDAO interface

func (ExpectedRackSQLDAO) Create

Create creates a new ExpectedRack from the given parameters The returned ExpectedRack will not have any related structs filled in. Since there are 2 operations (INSERT, SELECT), it is required that this library call happens within a transaction

func (ExpectedRackSQLDAO) CreateMultiple

func (erd ExpectedRackSQLDAO) CreateMultiple(ctx context.Context, tx *db.Tx, inputs []ExpectedRackCreateInput) ([]ExpectedRack, error)

CreateMultiple creates multiple ExpectedRacks from the given parameters The returned ExpectedRacks will not have any related structs filled in. Since there are 2 operations (INSERT, SELECT), it is required that this library call happens within a transaction

func (ExpectedRackSQLDAO) Delete

func (erd ExpectedRackSQLDAO) Delete(ctx context.Context, tx *db.Tx, expectedRackID uuid.UUID) error

Delete deletes an ExpectedRack by ID Error is returned only if there is a db error

func (ExpectedRackSQLDAO) DeleteAll

func (erd ExpectedRackSQLDAO) DeleteAll(ctx context.Context, tx *db.Tx, filter ExpectedRackFilterInput) error

DeleteAll deletes all ExpectedRacks matching the given filter (typically scoped by site). Callers must supply at least one filter; an empty filter is rejected with db.ErrInvalidParams to prevent wiping the entire table. Error is returned only if there is a db error or no filter was supplied.

func (ExpectedRackSQLDAO) Get

func (erd ExpectedRackSQLDAO) Get(ctx context.Context, tx *db.Tx, expectedRackID uuid.UUID, includeRelations []string, forUpdate bool) (*ExpectedRack, error)

Get returns an ExpectedRack by ID returns db.ErrDoesNotExist error if the record is not found

func (ExpectedRackSQLDAO) GetAll

func (erd ExpectedRackSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter ExpectedRackFilterInput, page paginator.PageInput, includeRelations []string) ([]ExpectedRack, int, error)

GetAll returns all ExpectedRacks based on the filter and paging Errors are returned only when there is a db related error If records not found, then error is nil, but length of returned slice is 0 If orderBy is nil, then records are ordered by column specified in ExpectedRackOrderByDefault in ascending order

func (ExpectedRackSQLDAO) ReplaceAll

ReplaceAll deletes all ExpectedRacks matching the given filter and replaces them with the provided inputs. Both operations occur in the same transaction so callers must provide a transaction.

func (ExpectedRackSQLDAO) Update

Update updates specified fields of an existing ExpectedRack The updated fields are assumed to be set to non-null values since there are 2 operations (UPDATE, SELECT), it is required that this library call happens within a transaction

func (ExpectedRackSQLDAO) UpdateMultiple

func (erd ExpectedRackSQLDAO) UpdateMultiple(ctx context.Context, tx *db.Tx, inputs []ExpectedRackUpdateInput) ([]ExpectedRack, error)

UpdateMultiple updates multiple ExpectedRacks with the given parameters using a single bulk UPDATE query All inputs should update the same set of fields for optimal performance. Since there are 2 operations (UPDATE, SELECT), it is required that this library call happens within a transaction

type ExpectedRackUpdateInput

type ExpectedRackUpdateInput struct {
	ExpectedRackID uuid.UUID
	RackID         *string
	RackProfileID  *string
	Name           *string
	Description    *string
	Labels         map[string]string
}

ExpectedRackUpdateInput input parameters for Update method

type ExpectedSwitch

type ExpectedSwitch struct {
	bun.BaseModel `bun:"table:expected_switch,alias:es"`

	ID                 uuid.UUID `bun:"id,pk"`
	SiteID             uuid.UUID `bun:"site_id,type:uuid,notnull"`
	Site               *Site     `bun:"rel:belongs-to,join:site_id=id"`
	BmcMacAddress      string    `bun:"bmc_mac_address,notnull"`
	SwitchSerialNumber string    `bun:"switch_serial_number,notnull"`
	BmcIpAddress       *string   `bun:"bmc_ip_address"`
	RackID             *string   `bun:"rack_id"`
	Name               *string   `bun:"name"`
	Manufacturer       *string   `bun:"manufacturer"`
	Model              *string   `bun:"model"`
	Description        *string   `bun:"description"`
	FirmwareVersion    *string   `bun:"firmware_version"`
	SlotID             *int32    `bun:"slot_id"`
	TrayIdx            *int32    `bun:"tray_idx"`
	HostID             *int32    `bun:"host_id"`
	Labels             Labels    `bun:"labels,type:jsonb"`
	Created            time.Time `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated            time.Time `bun:"updated,nullzero,notnull,default:current_timestamp"`
	CreatedBy          uuid.UUID `bun:"type:uuid,notnull"`
}

ExpectedSwitch is a record for each network switch expected to be processed by NICo

func (*ExpectedSwitch) BeforeAppendModel

func (es *ExpectedSwitch) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*ExpectedSwitch) BeforeCreateTable

func (es *ExpectedSwitch) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created This is only used in tests

func (*ExpectedSwitch) FromProto

func (es *ExpectedSwitch) FromProto(proto *cwssaws.ExpectedSwitch)

FromProto populates this ExpectedSwitch from a workflow proto reported by a Site. A nil proto is a no-op. An invalid or missing proto.ExpectedSwitchId leaves es.ID unchanged so the caller can validate the proto's UUID before calling.

func (*ExpectedSwitch) ToProto

ToProto builds the workflow proto for this ExpectedSwitch. BMC and NVOS credentials are passed in because they aren't persisted on the record; labels are read from es.Labels.

type ExpectedSwitchClearInput

type ExpectedSwitchClearInput struct {
	ExpectedSwitchID uuid.UUID
	BmcIpAddress     bool
	RackID           bool
	Name             bool
	Manufacturer     bool
	Model            bool
	Description      bool
	FirmwareVersion  bool
	SlotID           bool
	TrayIdx          bool
	HostID           bool
	Labels           bool
}

ExpectedSwitchClearInput input parameters for Clear method

type ExpectedSwitchCreateInput

type ExpectedSwitchCreateInput struct {
	ExpectedSwitchID   uuid.UUID
	SiteID             uuid.UUID
	BmcMacAddress      string
	SwitchSerialNumber string
	BmcIpAddress       *string
	RackID             *string
	Name               *string
	Manufacturer       *string
	Model              *string
	Description        *string
	FirmwareVersion    *string
	SlotID             *int32
	TrayIdx            *int32
	HostID             *int32
	Labels             map[string]string
	CreatedBy          uuid.UUID
}

ExpectedSwitchCreateInput input parameters for Create method

type ExpectedSwitchCredentials

type ExpectedSwitchCredentials struct {
	BmcUsername  *string
	BmcPassword  *string
	NvosUsername *string
	NvosPassword *string
}

ExpectedSwitchCredentials carries the BMC and NVOS credentials for one ExpectedSwitch. They live in their own type because they aren't stored in the DB record and have to be threaded through to ToProto separately.

type ExpectedSwitchDAO

type ExpectedSwitchDAO interface {
	// Create used to create new row
	Create(ctx context.Context, tx *db.Tx, input ExpectedSwitchCreateInput) (*ExpectedSwitch, error)
	// Update used to update row
	Update(ctx context.Context, tx *db.Tx, input ExpectedSwitchUpdateInput) (*ExpectedSwitch, error)
	// Delete used to delete row
	Delete(ctx context.Context, tx *db.Tx, expectedSwitchID uuid.UUID) error
	// Clear used to clear fields in the row
	Clear(ctx context.Context, tx *db.Tx, input ExpectedSwitchClearInput) (*ExpectedSwitch, error)
	// GetAll returns all the rows based on the filter and page inputs
	GetAll(ctx context.Context, tx *db.Tx, filter ExpectedSwitchFilterInput, page paginator.PageInput, includeRelations []string) ([]ExpectedSwitch, int, error)
	// Get returns row for specified ID
	Get(ctx context.Context, tx *db.Tx, expectedSwitchID uuid.UUID, includeRelations []string, forUpdate bool) (*ExpectedSwitch, error)
}

ExpectedSwitchDAO is an interface for interacting with the ExpectedSwitch model

func NewExpectedSwitchDAO

func NewExpectedSwitchDAO(dbSession *db.Session) ExpectedSwitchDAO

NewExpectedSwitchDAO returns a new ExpectedSwitchDAO

type ExpectedSwitchFilterInput

type ExpectedSwitchFilterInput struct {
	ExpectedSwitchIDs   []uuid.UUID
	SiteIDs             []uuid.UUID
	BmcMacAddresses     []string
	SwitchSerialNumbers []string
	SearchQuery         *string
}

ExpectedSwitchFilterInput filtering options for GetAll method

type ExpectedSwitchSQLDAO

type ExpectedSwitchSQLDAO struct {
	ExpectedSwitchDAO
	// contains filtered or unexported fields
}

ExpectedSwitchSQLDAO is an implementation of the ExpectedSwitchDAO interface

func (ExpectedSwitchSQLDAO) Clear

Clear sets parameters of an existing ExpectedSwitch to null values in db

func (ExpectedSwitchSQLDAO) Create

Create creates a new ExpectedSwitch from the given parameters The returned ExpectedSwitch will not have any related structs filled in. Since there are 2 operations (INSERT, SELECT), it is required that this library call happens within a transaction

func (ExpectedSwitchSQLDAO) Delete

func (essd ExpectedSwitchSQLDAO) Delete(ctx context.Context, tx *db.Tx, expectedSwitchID uuid.UUID) error

Delete deletes an ExpectedSwitch by ID Error is returned only if there is a db error

func (ExpectedSwitchSQLDAO) Get

func (essd ExpectedSwitchSQLDAO) Get(ctx context.Context, tx *db.Tx, expectedSwitchID uuid.UUID, includeRelations []string, forUpdate bool) (*ExpectedSwitch, error)

Get returns an ExpectedSwitch by ID returns db.ErrDoesNotExist error if the record is not found

func (ExpectedSwitchSQLDAO) GetAll

func (essd ExpectedSwitchSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter ExpectedSwitchFilterInput, page paginator.PageInput, includeRelations []string) ([]ExpectedSwitch, int, error)

GetAll returns all ExpectedSwitches based on the filter and paging Errors are returned only when there is a db related error If records not found, then error is nil, but length of returned slice is 0 If orderBy is nil, then records are ordered by column specified in ExpectedSwitchOrderByDefault in ascending order

func (ExpectedSwitchSQLDAO) Update

Update updates specified fields of an existing ExpectedSwitch The updated fields are assumed to be set to non-null values For setting to null values, use: Clear since there are 2 operations (UPDATE, SELECT), it is required that this library call happens within a transaction

type ExpectedSwitchUpdateInput

type ExpectedSwitchUpdateInput struct {
	ExpectedSwitchID   uuid.UUID
	BmcMacAddress      *string
	SwitchSerialNumber *string
	BmcIpAddress       *string
	RackID             *string
	Name               *string
	Manufacturer       *string
	Model              *string
	Description        *string
	FirmwareVersion    *string
	SlotID             *int32
	TrayIdx            *int32
	HostID             *int32
	Labels             map[string]string
}

ExpectedSwitchUpdateInput input parameters for Update method

type Fabric

type Fabric struct {
	bun.BaseModel `bun:"table:fabric,alias:fb"`

	ID                       string                  `bun:"id,notnull,pk"`
	Org                      string                  `bun:"org,notnull"`
	SiteID                   uuid.UUID               `bun:"site_id,type:uuid,notnull,pk"`
	Site                     *Site                   `bun:"rel:belongs-to,join:site_id=id"`
	InfrastructureProviderID uuid.UUID               `bun:"infrastructure_provider_id,type:uuid,notnull"`
	InfrastructureProvider   *InfrastructureProvider `bun:"rel:belongs-to,join:infrastructure_provider_id=id"`
	Status                   string                  `bun:"status,notnull"`
	IsMissingOnSite          bool                    `bun:"is_missing_on_site,notnull"`
	Created                  time.Time               `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                  time.Time               `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                  *time.Time              `bun:"deleted,soft_delete"`
}

Fabric represents a collection of Fabric

func (*Fabric) BeforeAppendModel

func (fb *Fabric) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*Fabric) BeforeCreateTable

func (a *Fabric) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type FabricDAO

type FabricDAO interface {
	//
	CreateFromParams(ctx context.Context, tx *db.Tx, id string, org string, siteID uuid.UUID, infrastructureProviderID uuid.UUID, status string) (*Fabric, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id string, siteID uuid.UUID, includeRelations []string) (*Fabric, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, org *string, siteID, infrastructureProviderID *uuid.UUID, status *string, ids []string, searchQuery *string, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]Fabric, int, error)
	//
	UpdateFromParams(ctx context.Context, tx *db.Tx, id string, siteID uuid.UUID, infrastructureProviderID *uuid.UUID, status *string, isMissingOnSite *bool) (*Fabric, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id string, siteID uuid.UUID) error
	//
	DeleteAll(ctx context.Context, tx *db.Tx, ids []string, siteID *uuid.UUID) error
}

FabricDAO is an interface for interacting with the Fabric model

func NewFabricDAO

func NewFabricDAO(dbSession *db.Session) FabricDAO

NewFabricDAO returns a new FabricDAO

type FabricSQLDAO

type FabricSQLDAO struct {
	FabricDAO
	// contains filtered or unexported fields
}

FabricSQLDAO is an implementation of the FabricDAO interface

func (FabricSQLDAO) CreateFromParams

func (fbsd FabricSQLDAO) CreateFromParams(ctx context.Context, tx *db.Tx, id string, org string, siteID uuid.UUID, infrastructureProviderID uuid.UUID, status string) (*Fabric, error)

CreateFromParams creates a new Fabric from the given parameters

func (FabricSQLDAO) DeleteAll

func (fbsd FabricSQLDAO) DeleteAll(ctx context.Context, tx *db.Tx, ids []string, siteID *uuid.UUID) error

DeleteAll deletes an Fabric by ID or Site ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned

func (FabricSQLDAO) DeleteByID

func (fbsd FabricSQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id string, siteID uuid.UUID) error

DeleteByID deletes an Fabric by ID and SiteID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned

func (FabricSQLDAO) GetAll

func (fbsd FabricSQLDAO) GetAll(ctx context.Context, tx *db.Tx, org *string, siteID, infrastructureProviderID *uuid.UUID, status *string, ids []string, searchQuery *string, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]Fabric, int, error)

GetAll returns all Fabrics filtering by Site, InfrastructureProvider and IDs errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in FabricOrderByDefault in ascending order

func (FabricSQLDAO) GetByID

func (fbsd FabricSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id string, siteID uuid.UUID, includeRelations []string) (*Fabric, error)

GetByID returns a Fabric by ID returns db.ErrDoesNotExist error if the record is not found

func (FabricSQLDAO) UpdateFromParams

func (fbsd FabricSQLDAO) UpdateFromParams(ctx context.Context, tx *db.Tx, id string, siteID uuid.UUID, infrastructureProviderID *uuid.UUID, status *string, isMissingOnSite *bool) (*Fabric, error)

UpdateFromParams updates specified fields of an existing Fabric The updated fields are assumed to be set to non-null values For setting to null values, use: ClearFromParams since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

type HealthProbeAlert

type HealthProbeAlert struct {
	Id              string   `json:"id"`
	Target          *string  `json:"target"`
	InAlertSince    *string  `json:"in_alert_since"`
	Message         string   `json:"message"`
	TenantMessage   *string  `json:"tenant_message"`
	Classifications []string `json:"classifications"`
}

type HealthProbeSuccess

type HealthProbeSuccess struct {
	Id     string  `json:"id"`
	Target *string `json:"target"`
}

type IPBlock

type IPBlock struct {
	bun.BaseModel `bun:"table:ip_block,alias:ipb"`

	ID                       uuid.UUID               `bun:"type:uuid,pk"`
	Name                     string                  `bun:"name,notnull"`
	Description              *string                 `bun:"description"`
	SiteID                   uuid.UUID               `bun:"site_id,type:uuid,notnull"`
	Site                     *Site                   `bun:"rel:belongs-to,join:site_id=id"`
	InfrastructureProviderID uuid.UUID               `bun:"infrastructure_provider_id,type:uuid,notnull"`
	InfrastructureProvider   *InfrastructureProvider `bun:"rel:belongs-to,join:infrastructure_provider_id=id"`
	TenantID                 *uuid.UUID              `bun:"tenant_id,type:uuid"`
	Tenant                   *Tenant                 `bun:"rel:belongs-to,join:tenant_id=id"`
	RoutingType              string                  `bun:"routing_type,notnull"`
	Prefix                   string                  `bun:"prefix,notnull"`
	PrefixLength             int                     `bun:"prefix_length,notnull"`
	ProtocolVersion          string                  `bun:"protocol_version,notnull"`
	FullGrant                bool                    `bun:"full_grant,notnull"`
	Status                   string                  `bun:"status,notnull"`
	Created                  time.Time               `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                  time.Time               `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                  *time.Time              `bun:"deleted,soft_delete"`
	CreatedBy                *uuid.UUID              `bun:"created_by,type:uuid"`
}

IPBlock contains information about an IPv4/v6 address pool owned by the InfrastructureProvider and assigned as an overlay network for a particular site

func TestBuildIPBlock

func TestBuildIPBlock(t *testing.T, dbSession *db.Session, name string, site *Site, tenant *Tenant, routingType, prefix string, blockSize int, protocolVersion string) *IPBlock

TestBuildIPBlock creates a test IP Block

func (*IPBlock) BeforeAppendModel

func (ipb *IPBlock) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*IPBlock) BeforeCreateTable

func (it *IPBlock) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type IPBlockClearInput

type IPBlockClearInput struct {
	IPBlockID   uuid.UUID
	Description bool
	TenantID    bool
}

IPBlockClearInput input parameters for Clear method

type IPBlockCreateInput

type IPBlockCreateInput struct {
	IPBlockID                *uuid.UUID
	Name                     string
	Description              *string
	SiteID                   uuid.UUID
	InfrastructureProviderID uuid.UUID
	TenantID                 *uuid.UUID
	RoutingType              string
	Prefix                   string
	PrefixLength             int
	ProtocolVersion          string
	FullGrant                bool
	Status                   string
	CreatedBy                *uuid.UUID
}

IPBlockCreateInput input parameters for Create method

type IPBlockDAO

type IPBlockDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input IPBlockCreateInput) (*IPBlock, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*IPBlock, error)
	//
	GetCountByStatus(ctx context.Context, tx *db.Tx, infrastructureProviderID *uuid.UUID, siteID *uuid.UUID, tenantID *uuid.UUID) (map[string]int, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter IPBlockFilterInput, page paginator.PageInput, includeRelations []string) ([]IPBlock, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input IPBlockUpdateInput) (*IPBlock, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input IPBlockClearInput) (*IPBlock, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

IPBlockDAO is an interface for interacting with the IPBlock model

func NewIPBlockDAO

func NewIPBlockDAO(dbSession *db.Session) IPBlockDAO

NewIPBlockDAO returns a new IPBlockDAO

type IPBlockFilterInput

type IPBlockFilterInput struct {
	IPBlockIDs                []uuid.UUID
	Names                     []string
	SiteIDs                   []uuid.UUID
	InfrastructureProviderIDs []uuid.UUID
	TenantIDs                 []uuid.UUID
	RoutingTypes              []string
	Prefixes                  []string
	PrefixLengths             []int
	ProtocolVersions          []string
	FullGrant                 *bool
	Statuses                  []string
	ExcludeDerived            bool
	SearchQuery               *string
}

IPBlockFilterInput input parameters for Filter method

type IPBlockSQLDAO

type IPBlockSQLDAO struct {
	IPBlockDAO
	// contains filtered or unexported fields
}

IPBlockSQLDAO is an implementation of the IPBlockDAO interface

func (IPBlockSQLDAO) Clear

func (ipbsd IPBlockSQLDAO) Clear(ctx context.Context, tx *db.Tx, input IPBlockClearInput) (*IPBlock, error)

ClearFromParams sets parameters of an existing IPBlock to null values in db parameters displayName, description, siteID when true, the are set to null in db since there are 2 operations (UPDATE, SELECT), it is required that this must be within a transaction

func (IPBlockSQLDAO) Create

func (ipbsd IPBlockSQLDAO) Create(ctx context.Context, tx *db.Tx, input IPBlockCreateInput) (*IPBlock, error)

Create creates a new IPBlock from the given parameters The returned IPBlock will not have any related structs (Site/InfrastructureProvider/Tenant) filled in since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (IPBlockSQLDAO) Delete

func (ipbsd IPBlockSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes an IPBlock by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (IPBlockSQLDAO) GetAll

func (ipbsd IPBlockSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter IPBlockFilterInput, page paginator.PageInput, includeRelations []string) ([]IPBlock, int, error)

GetAll returns all IPBlocks filtering by Site, InfrastructureProvider Tenant, RoutingType or Name errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in IPBlockOrderByDefault in ascending order

func (IPBlockSQLDAO) GetByID

func (ipbsd IPBlockSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*IPBlock, error)

GetByID returns a IPBlock by ID includeRelation can be a subset of "Site", "InfrastructureProvider", "Tenant" returns db.ErrDoesNotExist error if the record is not found

func (IPBlockSQLDAO) GetCountByStatus

func (ipbsd IPBlockSQLDAO) GetCountByStatus(ctx context.Context, tx *db.Tx, infrastructureProviderID *uuid.UUID, siteID *uuid.UUID, tenantID *uuid.UUID) (map[string]int, error)

GetCountByStatus returns count of IPBlocks for given status Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned map is 0

func (IPBlockSQLDAO) Update

func (ipbsd IPBlockSQLDAO) Update(ctx context.Context, tx *db.Tx, input IPBlockUpdateInput) (*IPBlock, error)

Update updates specified fields of an existing IPBlock The updated fields are assumed to be set to non-null values For setting to null values, use: ClearFromParams since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

type IPBlockUpdateInput

type IPBlockUpdateInput struct {
	IPBlockID                uuid.UUID
	Name                     *string
	Description              *string
	SiteID                   *uuid.UUID
	InfrastructureProviderID *uuid.UUID
	TenantID                 *uuid.UUID
	RoutingType              *string
	Prefix                   *string
	PrefixLength             *int
	ProtocolVersion          *string
	FullGrant                *bool
	Status                   *string
}

IPBlockUpdateInput input parameters for Update method

type InfiniBandInterface

type InfiniBandInterface struct {
	bun.BaseModel `bun:"table:infiniband_interface,alias:ibi"`

	ID                    uuid.UUID            `bun:"type:uuid,pk"`
	InstanceID            uuid.UUID            `bun:"instance_id,type:uuid,notnull"`
	Instance              *Instance            `bun:"rel:belongs-to,join:instance_id=id"`
	SiteID                uuid.UUID            `bun:"site_id,type:uuid,notnull"`
	Site                  *Site                `bun:"rel:belongs-to,join:site_id=id"`
	InfiniBandPartitionID uuid.UUID            `bun:"infiniband_partition_id,type:uuid,notnull"`
	InfiniBandPartition   *InfiniBandPartition `bun:"rel:belongs-to,join:infiniband_partition_id=id"`
	Device                string               `bun:"device,notnull"`
	Vendor                *string              `bun:"vendor"`
	DeviceInstance        int                  `bun:"device_instance,notnull"`
	IsPhysical            bool                 `bun:"is_physical,notnull"`
	VirtualFunctionID     *int                 `bun:"virtual_function_id"`
	PhysicalGUID          *string              `bun:"physical_guid"`
	GUID                  *string              `bun:"guid"`
	Status                string               `bun:"status,notnull"`
	IsMissingOnSite       bool                 `bun:"is_missing_on_site,notnull"`
	Created               time.Time            `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated               time.Time            `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted               *time.Time           `bun:"deleted,soft_delete"`
	CreatedBy             uuid.UUID            `bun:"type:uuid,notnull"`
}

InfiniBandInterface represents entries in the InfiniBandInterface table

func (*InfiniBandInterface) BeforeAppendModel

func (ibi *InfiniBandInterface) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*InfiniBandInterface) BeforeCreateTable

func (ibi *InfiniBandInterface) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type InfiniBandInterfaceClearInput

type InfiniBandInterfaceClearInput struct {
	InfiniBandInterfaceID uuid.UUID
	Vendor                bool
	VirtualFunctionId     bool
	PhysicalGUID          bool
	GUID                  bool
}

InfiniBandInterfaceClearInput input parameters for Clear method

type InfiniBandInterfaceCreateInput

type InfiniBandInterfaceCreateInput struct {
	InfiniBandInterfaceID *uuid.UUID
	InstanceID            uuid.UUID
	SiteID                uuid.UUID
	InfiniBandPartitionID uuid.UUID
	Device                string
	Vendor                *string
	DeviceInstance        int
	IsPhysical            bool
	VirtualFunctionID     *int
	PhysicalGUID          *string
	GUID                  *string
	Status                string
	CreatedBy             uuid.UUID
}

InfiniBandInterfaceCreateInput input parameters for Create method

type InfiniBandInterfaceDAO

type InfiniBandInterfaceDAO interface {
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*InfiniBandInterface, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter InfiniBandInterfaceFilterInput, page paginator.PageInput, includeRelations []string) ([]InfiniBandInterface, int, error)
	//
	Create(ctx context.Context, tx *db.Tx, input InfiniBandInterfaceCreateInput) (*InfiniBandInterface, error)
	//
	CreateMultiple(ctx context.Context, tx *db.Tx, inputs []InfiniBandInterfaceCreateInput) ([]InfiniBandInterface, error)
	//
	Update(ctx context.Context, tx *db.Tx, input InfiniBandInterfaceUpdateInput) (*InfiniBandInterface, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input InfiniBandInterfaceClearInput) (*InfiniBandInterface, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
	//
	DeleteAllBySiteID(ctx context.Context, tx *db.Tx, siteID uuid.UUID) error
}

InfiniBandInterfaceDAO is an interface for interacting with the InfiniBandInterface model

func NewInfiniBandInterfaceDAO

func NewInfiniBandInterfaceDAO(dbSession *db.Session) InfiniBandInterfaceDAO

NewInfiniBandInterfaceDAO returns a new InfiniBandInterfaceDAO

type InfiniBandInterfaceFilterInput

type InfiniBandInterfaceFilterInput struct {
	InfiniBandInterfaceIDs []uuid.UUID
	SiteIDs                []uuid.UUID
	InfiniBandPartitionIDs []uuid.UUID
	InstanceIDs            []uuid.UUID
	Statuses               []string
	Devices                []string
	Vendors                []string
	IsPhysical             *bool
	PhysicalGUIDs          []string
	GUIDs                  []string
	SearchQuery            *string
}

InfiniBandInterfaceFilterInput input parameters for Filter method

type InfiniBandInterfaceSQLDAO

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

InfiniBandInterfaceSQLDAO is an implementation of the InfiniBandInterfaceDAO interface

func (InfiniBandInterfaceSQLDAO) Clear

Clear clears InfiniBandInterface attributes based on provided arguments

func (InfiniBandInterfaceSQLDAO) Create

Create creates a new InfiniBandInterface from the given parameters

func (InfiniBandInterfaceSQLDAO) CreateMultiple

CreateMultiple creates multiple InfiniBandInterfaces from the given parameters

func (InfiniBandInterfaceSQLDAO) Delete

func (ibisd InfiniBandInterfaceSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes a InfiniBandInterface by ID

func (InfiniBandInterfaceSQLDAO) DeleteAllBySiteID

func (ibisd InfiniBandInterfaceSQLDAO) DeleteAllBySiteID(ctx context.Context, tx *db.Tx, siteID uuid.UUID) error

DeleteAllBySiteID deletes all InfiniBandInterface records for a given Site error is returned only if there is a db error

func (InfiniBandInterfaceSQLDAO) GetAll

func (ibisd InfiniBandInterfaceSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter InfiniBandInterfaceFilterInput, page paginator.PageInput, includeRelations []string) ([]InfiniBandInterface, int, error)

GetAll returns all InfiniBandInterfaces for a tenant or site Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in InfiniBandInterfaceOrderByDefault in ascending order

func (InfiniBandInterfaceSQLDAO) GetByID

func (ibisd InfiniBandInterfaceSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*InfiniBandInterface, error)

GetByID returns a InfiniBandInterface by ID

func (InfiniBandInterfaceSQLDAO) Update

Update updates an existing InfiniBandInterface from the given parameters

type InfiniBandInterfaceUpdateInput

type InfiniBandInterfaceUpdateInput struct {
	InfiniBandInterfaceID uuid.UUID
	Device                *string
	Vendor                *string
	DeviceInstance        *int
	IsPhysical            *bool
	VirtualFunctionId     *int
	PhysicalGUID          *string
	GUID                  *string
	Status                *string
	IsMissingOnSite       *bool
}

InfiniBandInterfaceUpdateInput input parameters for Update method

type InfiniBandPartition

type InfiniBandPartition struct {
	bun.BaseModel `bun:"table:infiniband_partition,alias:ibp"`

	ID                      uuid.UUID         `bun:"type:uuid,pk"`
	Name                    string            `bun:"name,notnull"`
	Description             *string           `bun:"description"`
	Org                     string            `bun:"org,notnull"`
	SiteID                  uuid.UUID         `bun:"site_id,type:uuid,notnull"`
	Site                    *Site             `bun:"rel:belongs-to,join:site_id=id"`
	TenantID                uuid.UUID         `bun:"tenant_id,type:uuid,notnull"`
	Tenant                  *Tenant           `bun:"rel:belongs-to,join:tenant_id=id"`
	ControllerIBPartitionID *uuid.UUID        `bun:"controller_ib_partition_id,type:uuid"`
	PartitionKey            *string           `bun:"partition_key"`
	PartitionName           *string           `bun:"partition_name"`
	ServiceLevel            *int              `bun:"service_level"`
	RateLimit               *float32          `bun:"rate_limit"`
	Mtu                     *int              `bun:"mtu"`
	EnableSharp             *bool             `bun:"enable_sharp"`
	Labels                  map[string]string `bun:"labels,type:jsonb"`
	Status                  string            `bun:"status,notnull"`
	IsMissingOnSite         bool              `bun:"is_missing_on_site,notnull"`
	Created                 time.Time         `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                 time.Time         `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                 *time.Time        `bun:"deleted,soft_delete"`
	CreatedBy               uuid.UUID         `bun:"type:uuid,notnull"`
}

InfiniBandPartition represents entries in the InfiniBandPartition table

func (*InfiniBandPartition) BeforeAppendModel

func (ibp *InfiniBandPartition) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*InfiniBandPartition) BeforeCreateTable

func (ibp *InfiniBandPartition) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type InfiniBandPartitionClearInput

type InfiniBandPartitionClearInput struct {
	InfiniBandPartitionID   uuid.UUID
	Description             bool
	ControllerIBPartitionID bool
	PartitionKey            bool
	PartitionName           bool
	ServiceLevel            bool
	RateLimit               bool
	Mtu                     bool
	EnableSharp             bool
	Labels                  bool
}

InfiniBandPartitionClearInput input parameters for Clear method

type InfiniBandPartitionCreateInput

type InfiniBandPartitionCreateInput struct {
	InfiniBandPartitionID   *uuid.UUID
	Name                    string
	Description             *string
	TenantOrg               string
	SiteID                  uuid.UUID
	TenantID                uuid.UUID
	ControllerIBPartitionID *uuid.UUID
	PartitionKey            *string
	PartitionName           *string
	ServiceLevel            *int
	RateLimit               *float32
	Mtu                     *int
	EnableSharp             *bool
	Labels                  map[string]string
	Status                  string
	CreatedBy               uuid.UUID
}

InfiniBandPartitionCreateInput input parameters for Create method

type InfiniBandPartitionDAO

type InfiniBandPartitionDAO interface {
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*InfiniBandPartition, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter InfiniBandPartitionFilterInput, page paginator.PageInput, includeRelations []string) ([]InfiniBandPartition, int, error)
	//
	Create(ctx context.Context, tx *db.Tx, input InfiniBandPartitionCreateInput) (*InfiniBandPartition, error)
	//
	Update(ctx context.Context, tx *db.Tx, input InfiniBandPartitionUpdateInput) (*InfiniBandPartition, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input InfiniBandPartitionClearInput) (*InfiniBandPartition, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

InfiniBandPartitionDAO is an interface for interacting with the InfiniBandPartition model

func NewInfiniBandPartitionDAO

func NewInfiniBandPartitionDAO(dbSession *db.Session) InfiniBandPartitionDAO

NewInfiniBandPartitionDAO returns a new InfiniBandPartitionDAO

type InfiniBandPartitionFilterInput

type InfiniBandPartitionFilterInput struct {
	InfiniBandPartitionIDs []uuid.UUID
	Names                  []string
	SiteIDs                []uuid.UUID
	TenantOrgs             []string
	TenantIDs              []uuid.UUID
	Statuses               []string
	SearchQuery            *string
	PartitionNames         []string
	PartitionKeys          []string
	SharpEnabled           *bool
}

InfiniBandPartitionFilterInput input parameters for Filter method

type InfiniBandPartitionSQLDAO

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

InfiniBandPartitionSQLDAO is an implementation of the InfiniBandPartitionDAO interface

func (InfiniBandPartitionSQLDAO) Clear

Clear clears InfiniBandPartition attributes based on provided arguments

func (InfiniBandPartitionSQLDAO) Create

Create creates a new InfiniBandPartition from the given parameters

func (InfiniBandPartitionSQLDAO) Delete

func (ibpsd InfiniBandPartitionSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes a InfiniBandPartition by ID

func (InfiniBandPartitionSQLDAO) GetAll

func (ibpsd InfiniBandPartitionSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter InfiniBandPartitionFilterInput, page paginator.PageInput, includeRelations []string) ([]InfiniBandPartition, int, error)

GetAll returns all Partitions for a tenant or site Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in InfiniBandPartitionOrderByDefault in ascending order

func (InfiniBandPartitionSQLDAO) GetByID

func (ibpsd InfiniBandPartitionSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*InfiniBandPartition, error)

GetByID returns a InfiniBandPartition by ID

func (InfiniBandPartitionSQLDAO) Update

Update updates an existing InfiniBandPartition from the given parameters

type InfiniBandPartitionUpdateInput

type InfiniBandPartitionUpdateInput struct {
	InfiniBandPartitionID   uuid.UUID
	Name                    *string
	Description             *string
	ControllerIBPartitionID *uuid.UUID
	PartitionKey            *string
	PartitionName           *string
	ServiceLevel            *int
	RateLimit               *float32
	Mtu                     *int
	EnableSharp             *bool
	Labels                  map[string]string
	Status                  *string
	IsMissingOnSite         *bool
}

InfiniBandPartitionUpdateInput input parameters for Update method

type InfrastructureProvider

type InfrastructureProvider struct {
	bun.BaseModel `bun:"table:infrastructure_provider,alias:ip"`

	ID             uuid.UUID  `bun:"type:uuid,pk"`
	Name           string     `bun:"name,notnull"`
	DisplayName    *string    `bun:"display_name"`
	Org            string     `bun:"org,notnull"`
	OrgDisplayName *string    `bun:"org_display_name"`
	Created        time.Time  `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated        time.Time  `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted        *time.Time `bun:"deleted,soft_delete"`
	CreatedBy      uuid.UUID  `bun:"type:uuid,notnull"`
}

InfrastructureProvider is the object for the infrastructure_provider table

func TestBuildInfrastructureProvider

func TestBuildInfrastructureProvider(t *testing.T, dbSession *db.Session, name string, org string, user *User) *InfrastructureProvider

TestBuildInfrastructureProvider creates a test Infrastructure Provider

func (*InfrastructureProvider) BeforeAppendModel

func (ip *InfrastructureProvider) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

type InfrastructureProviderDAO

type InfrastructureProviderDAO interface {
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*InfrastructureProvider, error)
	//
	GetAllByOrg(ctx context.Context, tx *db.Tx, org string, includeRelations []string) ([]InfrastructureProvider, error)
	//
	CreateFromParams(ctx context.Context, tx *db.Tx, name string, displayName *string, org string, orgDisplayName *string, createdBy *User) (*InfrastructureProvider, error)
	//
	UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, name *string, displayName *string, orgDisplayName *string) (*InfrastructureProvider, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

InfrastructureProviderDAO is the data access interface for InfrastructureProvider

func NewInfrastructureProviderDAO

func NewInfrastructureProviderDAO(dbSession *db.Session) InfrastructureProviderDAO

NewInfrastructureProviderDAO creates and returns a new data access object for InfrastructureProvider

type InfrastructureProviderSQLDAO

type InfrastructureProviderSQLDAO struct {
	InfrastructureProviderDAO
	// contains filtered or unexported fields
}

InfrastructureProviderSQLDAO implements InfrastructureProviderDAO interface for SQL

func (InfrastructureProviderSQLDAO) CreateFromParams

func (ipsd InfrastructureProviderSQLDAO) CreateFromParams(ctx context.Context, tx *db.Tx, name string, displayName *string, org string, orgDisplayName *string, createdBy *User) (*InfrastructureProvider, error)

CreateFromParams creates a new InfrastructureProvider from the given parameters

func (InfrastructureProviderSQLDAO) DeleteByID

func (ipsd InfrastructureProviderSQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error

DeleteByID deletes the InfrastructureProvider with the given ID

func (InfrastructureProviderSQLDAO) GetAllByOrg

func (ipsd InfrastructureProviderSQLDAO) GetAllByOrg(ctx context.Context, tx *db.Tx, org string, includeRelations []string) ([]InfrastructureProvider, error)

GetAllByOrg returns the InfrastructureProviders with the given org

func (InfrastructureProviderSQLDAO) GetByID

func (ipsd InfrastructureProviderSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*InfrastructureProvider, error)

GetByID returns the InfrastructureProvider with the given ID

func (InfrastructureProviderSQLDAO) UpdateFromParams

func (ipsd InfrastructureProviderSQLDAO) UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, name *string, displayName *string, orgDisplayName *string) (*InfrastructureProvider, error)

UpdateFromParams updates the InfrastructureProvider with the given parameters

type Instance

type Instance struct {
	bun.BaseModel `bun:"table:instance,alias:i"`

	ID                                     uuid.UUID                               `bun:"type:uuid,pk"`
	Name                                   string                                  `bun:"name,notnull"`
	Description                            *string                                 `bun:"description"`
	TenantID                               uuid.UUID                               `bun:"tenant_id,type:uuid,notnull"`
	Tenant                                 *Tenant                                 `bun:"rel:belongs-to,join:tenant_id=id"`
	InfrastructureProviderID               uuid.UUID                               `bun:"infrastructure_provider_id,type:uuid,notnull"`
	InfrastructureProvider                 *InfrastructureProvider                 `bun:"rel:belongs-to,join:infrastructure_provider_id=id"`
	SiteID                                 uuid.UUID                               `bun:"site_id,type:uuid,notnull"`
	Site                                   *Site                                   `bun:"rel:belongs-to,join:site_id=id"`
	NetworkSecurityGroupID                 *string                                 `bun:"network_security_group_id"`
	NetworkSecurityGroup                   *NetworkSecurityGroup                   `bun:"rel:belongs-to,join:network_security_group_id=id"`
	NetworkSecurityGroupPropagationDetails *NetworkSecurityGroupPropagationDetails `bun:"network_security_group_propagation_details,type:jsonb"`
	InstanceTypeID                         *uuid.UUID                              `bun:"instance_type_id,type:uuid"`
	InstanceType                           *InstanceType                           `bun:"rel:belongs-to,join:instance_type_id=id"`
	VpcID                                  uuid.UUID                               `bun:"vpc_id,type:uuid,notnull"`
	Vpc                                    *Vpc                                    `bun:"rel:belongs-to,join:vpc_id=id"`
	MachineID                              *string                                 `bun:"machine_id"`
	Machine                                *Machine                                `bun:"rel:belongs-to,join:machine_id=id"`
	ControllerInstanceID                   *uuid.UUID                              `bun:"controller_instance_id,type:uuid"`
	Hostname                               *string                                 `bun:"hostname"`
	OperatingSystemID                      *uuid.UUID                              `bun:"operating_system_id,type:uuid"`
	OperatingSystem                        *OperatingSystem                        `bun:"rel:belongs-to,join:operating_system_id=id"`
	IpxeScript                             *string                                 `bun:"ipxe_script"`
	AlwaysBootWithCustomIpxe               bool                                    `bun:"always_boot_with_custom_ipxe,notnull"`
	PhoneHomeEnabled                       bool                                    `bun:"phone_home_enabled,notnull"`
	UserData                               *string                                 `bun:"user_data"`
	Labels                                 map[string]string                       `bun:"labels,type:jsonb"`
	IsUpdatePending                        bool                                    `bun:"is_update_pending,notnull"`
	InfinityRCRStatus                      *string                                 `bun:"infinity_rcr_status"`
	TpmEkCertificate                       *string                                 `bun:"tpm_ek_certificate"`
	Status                                 string                                  `bun:"status,notnull"`
	PowerStatus                            *string                                 `bun:"power_status"`
	IsMissingOnSite                        bool                                    `bun:"is_missing_on_site,notnull"`
	Created                                time.Time                               `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                                time.Time                               `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                                *time.Time                              `bun:"deleted,soft_delete"`
	CreatedBy                              uuid.UUID                               `bun:"created_by,type:uuid,notnull"`
	// Not for display, used by the query that sorts on machine capability type, specifically InfiniBand type
	MCType string `bun:"mc_type,scanonly"`
}

Instance is a bare-metal machine that has been provisioned for a tenant

func TestBuildInstance

func TestBuildInstance(t *testing.T, dbSession *db.Session, name string, tn *Tenant, ip *InfrastructureProvider, st *Site, it *InstanceType, vpc *Vpc, m *Machine, os *OperatingSystem) *Instance

TestBuildInstance creates a test instance. It returns a persisted instance without any allocation linkage.

func (*Instance) BeforeAppendModel

func (i *Instance) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*Instance) BeforeCreateTable

func (i *Instance) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type InstanceClearInput

type InstanceClearInput struct {
	InstanceID                             uuid.UUID
	Description                            bool
	MachineID                              bool
	ControllerInstanceID                   bool
	NetworkSecurityGroupID                 bool
	NetworkSecurityGroupPropagationDetails bool
	Hostname                               bool
	OperatingSystemID                      bool
	IpxeScript                             bool
	UserData                               bool
	Labels                                 bool
	TpmEkCertificate                       bool
}

InstanceClearInput input parameters for Clear method

type InstanceCreateInput

type InstanceCreateInput struct {
	Name                                   string
	Description                            *string
	TenantID                               uuid.UUID
	InfrastructureProviderID               uuid.UUID
	SiteID                                 uuid.UUID
	InstanceTypeID                         *uuid.UUID
	NetworkSecurityGroupID                 *string
	NetworkSecurityGroupPropagationDetails *NetworkSecurityGroupPropagationDetails
	VpcID                                  uuid.UUID
	MachineID                              *string
	ControllerInstanceID                   *uuid.UUID
	Hostname                               *string
	OperatingSystemID                      *uuid.UUID
	IpxeScript                             *string
	AlwaysBootWithCustomIpxe               bool
	PhoneHomeEnabled                       bool
	UserData                               *string
	Labels                                 map[string]string
	IsUpdatePending                        bool
	InfinityRCRStatus                      *string
	TpmEkCertificate                       *string
	Status                                 string
	PowerStatus                            *string
	CreatedBy                              uuid.UUID
}

InstanceCreateInput input parameters for Create method

type InstanceDAO

type InstanceDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input InstanceCreateInput) (*Instance, error)
	//
	CreateMultiple(ctx context.Context, tx *db.Tx, inputs []InstanceCreateInput) ([]Instance, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Instance, error)
	//
	GetCountByStatus(ctx context.Context, tx *db.Tx, tenantID *uuid.UUID, siteID *uuid.UUID) (map[string]int, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter InstanceFilterInput, page paginator.PageInput, includeRelations []string) ([]Instance, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input InstanceUpdateInput) (*Instance, error)
	// UpdateMultiple used to update multiple rows
	UpdateMultiple(ctx context.Context, tx *db.Tx, inputs []InstanceUpdateInput) ([]Instance, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input InstanceClearInput) (*Instance, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
	// GetCount returns total count of rows for specified filter
	GetCount(ctx context.Context, tx *db.Tx, filter InstanceFilterInput) (count int, err error)
}

InstanceDAO is an interface for interacting with the Instance model

func NewInstanceDAO

func NewInstanceDAO(dbSession *db.Session) InstanceDAO

NewInstanceDAO returns a new InstanceDAO

type InstanceFilterInput

type InstanceFilterInput struct {
	InstanceIDs               []uuid.UUID
	Names                     []string
	TenantIDs                 []uuid.UUID
	InfrastructureProviderIDs []uuid.UUID
	SiteIDs                   []uuid.UUID
	InstanceTypeIDs           []uuid.UUID
	NetworkSecurityGroupIDs   []string
	VpcIDs                    []uuid.UUID
	MachineIDs                []string
	ControllerInstanceIDs     []uuid.UUID
	OperatingSystemIDs        []uuid.UUID
	Statuses                  []string
	SearchQuery               *string
}

InstanceFilterInput input parameters for GetAll method

type InstanceSQLDAO

type InstanceSQLDAO struct {
	InstanceDAO
	// contains filtered or unexported fields
}

InstanceSQLDAO is an implementation of the InstanceDAO interface

func (InstanceSQLDAO) Clear

func (isd InstanceSQLDAO) Clear(ctx context.Context, tx *db.Tx, input InstanceClearInput) (*Instance, error)

Clear sets parameters of an existing Instance to null values in db parameters when true, the are set to null in db since there are 2 operations (UPDATE, SELECT), it is required that this must be within a transaction

func (InstanceSQLDAO) Create

func (isd InstanceSQLDAO) Create(ctx context.Context, tx *db.Tx, input InstanceCreateInput) (*Instance, error)

Create creates a new Instance from the given parameters The returned Instance will not have any related structs (InfrastructureProvider/Site etc) filled in since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (InstanceSQLDAO) CreateMultiple

func (isd InstanceSQLDAO) CreateMultiple(ctx context.Context, tx *db.Tx, inputs []InstanceCreateInput) ([]Instance, error)

CreateMultiple creates multiple Instances from the given parameters The returned Instances will not have any related structs filled in since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (InstanceSQLDAO) Delete

func (isd InstanceSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes an Instance by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (InstanceSQLDAO) GetAll

func (isd InstanceSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter InstanceFilterInput, page paginator.PageInput, includeRelations []string) ([]Instance, int, error)

GetAll returns all Instances filtered by the fields in InstanceFilterInput: InstanceIDs, Names, TenantIDs, InfrastructureProviderIDs, SiteIDs, InstanceTypeIDs, VpcIDs, MachineIDs, ControllerInstanceIDs, OperatingSystemIDs, IDsNotIn, SearchQuery, Statuses, TenantOrgName, Labels, NetworkSecurityGroupIDs, and Hostnames. Allocation-based filters are intentionally omitted because direct instance-allocation linkage was removed. errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if page.OrderBy is nil, then records are ordered by column specified in InstanceOrderByDefault in ascending order

func (InstanceSQLDAO) GetByID

func (isd InstanceSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Instance, error)

GetByID returns a Instance by ID includeRelation can be a subset of "Tenant", "InfrastructureProvider" "Site", "InstanceType", "Vpc", "Machine", "OperatingSystem", "NetworkSecurityGroup" Allocation relations are intentionally omitted because direct instance-allocation linkage was removed. returns db.ErrDoesNotExist error if the record is not found

func (InstanceSQLDAO) GetCount

func (isd InstanceSQLDAO) GetCount(ctx context.Context, tx *db.Tx, filter InstanceFilterInput) (count int, err error)

GetCount returns total count of rows for specified filter

func (InstanceSQLDAO) GetCountByStatus

func (isd InstanceSQLDAO) GetCountByStatus(ctx context.Context, tx *db.Tx, tenantID *uuid.UUID, siteID *uuid.UUID) (map[string]int, error)

GetCountByStatus returns count of Instances for given status Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned map is 0

func (InstanceSQLDAO) Update

func (isd InstanceSQLDAO) Update(ctx context.Context, tx *db.Tx, input InstanceUpdateInput) (*Instance, error)

Update updates specified fields of an existing Instance The updated fields are assumed to be set to non-null values For setting to null values, use: Clear since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

func (InstanceSQLDAO) UpdateMultiple

func (isd InstanceSQLDAO) UpdateMultiple(ctx context.Context, tx *db.Tx, inputs []InstanceUpdateInput) ([]Instance, error)

UpdateMultiple updates multiple Instances with the given parameters using a single bulk UPDATE query All inputs should update the same set of fields for optimal performance The updated fields are assumed to be set to non-null values since there are 2 operations (UPDATE, SELECT), it is required that this library call happens within a transaction

type InstanceType

type InstanceType struct {
	bun.BaseModel `bun:"table:instance_type,alias:it"`

	ID                       uuid.UUID               `bun:"type:uuid,pk"`
	Name                     string                  `bun:"name,notnull"`
	DisplayName              *string                 `bun:"display_name"`
	Description              *string                 `bun:"description"`
	ControllerMachineType    *string                 `bun:"controller_machine_type"`
	InfrastructureProviderID uuid.UUID               `bun:"infrastructure_provider_id,type:uuid,notnull"`
	InfrastructureProvider   *InfrastructureProvider `bun:"rel:belongs-to,join:infrastructure_provider_id=id"`
	InfinityResourceTypeID   *uuid.UUID              `bun:"infinity_resource_type_id,type:uuid"`
	SiteID                   *uuid.UUID              `bun:"site_id,type:uuid"`
	Site                     *Site                   `bun:"rel:belongs-to,join:site_id=id"`
	Labels                   Labels                  `bun:"labels,type:jsonb"`
	Status                   string                  `bun:"status,notnull"`
	Created                  time.Time               `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                  time.Time               `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                  *time.Time              `bun:"deleted,soft_delete"`
	CreatedBy                uuid.UUID               `bun:"type:uuid,notnull"`
	Version                  string                  `bun:"version,notnull"`

	// Capabilities is the set of MachineCapability rows that describe this
	// InstanceType's filter attributes. Populated either via a bun query
	// with `.Relation("Capabilities")` or by the handler assigning the
	// loaded slice directly before calling `ToProto`. Ordering matters at
	// the wire — callers are responsible for sorting by Index before
	// assigning. Not persisted on InstanceType itself; the relation is
	// "instance_type has-many machine_capability".
	Capabilities []*MachineCapability `bun:"rel:has-many,join:id=instance_type_id"`
}

InstanceType represents entries in the instance_type table describes a set of machines that match certain criteria

func TestBuildInstanceType

func TestBuildInstanceType(t *testing.T, dbSession *db.Session, name string, ip *InfrastructureProvider, site *Site, user *User) *InstanceType

TestBuildInstanceType creates a test Instance Type

func (*InstanceType) AttachCapabilities added in v1.6.0

func (it *InstanceType) AttachCapabilities(mcs []MachineCapability)

AttachCapabilities populates `it.Capabilities` from a DAO-loaded `[]MachineCapability` slice, sorting by `Index` first so the wire ordering matches what NICo expects. Callers (handlers) hand off the raw DAO output and let the entity own the slice-of-values-to- slice-of-pointers shape needed for ToProto.

func (*InstanceType) BeforeAppendModel

func (it *InstanceType) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*InstanceType) BeforeCreateTable

func (it *InstanceType) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created This is only used in tests

func (*InstanceType) FromProto added in v1.6.0

func (it *InstanceType) FromProto(proto *cwssaws.InstanceType)

FromProto populates this InstanceType from its workflow proto representation. A nil proto is a no-op. This is the inverse of `ToProto` and exists for convention symmetry — currently no code path on the cloud side reconstructs a full InstanceType entity from a `cwssaws.InstanceType` (the site is the destination, not the source), but the method is provided so future reconciliation flows have a single canonical entry point.

Field-level contract:

  • `it.ID` is preserved on a missing or unparseable `proto.Id`, because callers pre-validate the UUID before calling.
  • `Name` is sourced from `proto.Metadata.Name`.
  • `Description` is cleared when the proto's Metadata omits it (empty string), so `FromProto` is a clean reset rather than a partial merge.
  • `Labels` are taken from `proto.Metadata.Labels`; a nil Metadata clears them.

`Attributes` (capabilities) is intentionally NOT mapped onto the receiver because capabilities live in a separate DB table and would require DAO writes the model layer should not perform.

func (*InstanceType) ToDeletionRequestProto added in v1.6.0

func (it *InstanceType) ToDeletionRequestProto() *cwssaws.DeleteInstanceTypeRequest

ToDeletionRequestProto builds the workflow request that asks a Site to delete this InstanceType. Lives on the entity because the delete handler has no API request body — the entity's ID is the only input.

func (*InstanceType) ToProto added in v1.6.0

func (it *InstanceType) ToProto() *cwssaws.InstanceType

ToProto converts this InstanceType into its workflow proto representation. Used as the canonical entity-to-proto conversion; request-shape protos (create / update) are produced by `ToProto` methods on the corresponding API request types in api/pkg/api/model/instancetype.go.

Capabilities come from `it.Capabilities` (populated either via a bun `.Relation("Capabilities")` query or by the handler via `AttachCapabilities`). Each MachineCapability does its own `mc.ToProto()` mapping, which is a pure mapper that trusts the request-side `Validate` having already gated the type / device-type / numeric bounds. A nil/empty `Capabilities` slice yields a nil `Attributes.DesiredCapabilities` so the proto round-trips cleanly.

type InstanceTypeClearInput

type InstanceTypeClearInput struct {
	InstanceTypeID uuid.UUID
	DisplayName    bool
	Description    bool
	SiteID         bool
	Labels         bool
}

InstanceTypeFilterInput input parameters for Clear method

type InstanceTypeCreateInput

type InstanceTypeCreateInput struct {
	ID                       *uuid.UUID
	Name                     string
	DisplayName              *string
	Description              *string
	ControllerMachineType    *string
	InfrastructureProviderID uuid.UUID
	InfinityResourceTypeID   *uuid.UUID
	SiteID                   *uuid.UUID
	Labels                   map[string]string
	Status                   string
	CreatedBy                uuid.UUID
	Version                  string
}

InstanceTypeCreateInput input parameters for Create method

type InstanceTypeDAO

type InstanceTypeDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, params InstanceTypeCreateInput) (*InstanceType, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*InstanceType, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter InstanceTypeFilterInput, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]InstanceType, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input InstanceTypeUpdateInput) (*InstanceType, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input InstanceTypeClearInput) (*InstanceType, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

InstanceTypeDAO is an interface for interacting with the InstanceType model

func NewInstanceTypeDAO

func NewInstanceTypeDAO(dbSession *db.Session) InstanceTypeDAO

NewInstanceTypeDAO returns a new InstanceTypeDAO

type InstanceTypeFilterInput

type InstanceTypeFilterInput struct {
	Name                     *string
	DisplayName              *string
	InfrastructureProviderID *uuid.UUID
	SiteIDs                  []uuid.UUID
	Status                   *string
	SearchQuery              *string
	InstanceTypeIDs          []uuid.UUID
	TenantIDs                []uuid.UUID // This implies filtering out any instance types with no allocations for the listed tenants.
}

Filter params for GetAll.

type InstanceTypeSQLDAO

type InstanceTypeSQLDAO struct {
	InstanceTypeDAO
	// contains filtered or unexported fields
}

InstanceTypeSQLDAO is an implementation of the InstanceTypeDAO interface

func (InstanceTypeSQLDAO) Clear

Clear sets parameters of an existing InstanceType to null values in db parameters displayName, description, siteID when true, the are set to null in db since there are 2 operations (UPDATE, SELECT), it is required that this must be within a transaction

func (InstanceTypeSQLDAO) Create

Create creates a new InstanceType from the given parameters The returned InstanceType will not have any related structs (InfrastructureProvider/Site) filled in since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (InstanceTypeSQLDAO) DeleteByID

func (itsd InstanceTypeSQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error

DeleteByID deletes an InstanceType by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (InstanceTypeSQLDAO) GetAll

func (itsd InstanceTypeSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter InstanceTypeFilterInput, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]InstanceType, int, error)

GetAll returns all InstanceTypes for an InfrastructureProvider Additional optional filters can be specified on name or on siteID errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in InstanceTypeOrderByDefault in ascending order

func (InstanceTypeSQLDAO) GetByID

func (itsd InstanceTypeSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*InstanceType, error)

GetByID returns a InstanceType by ID returns db.ErrDoesNotExist error if the record is not found

func (InstanceTypeSQLDAO) Update

Update updates specified fields of an existing InstanceType The updated fields are assumed to be set to non-null values For setting to null values, use: ClearFromParams since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

type InstanceTypeUpdateInput

type InstanceTypeUpdateInput struct {
	ID                     uuid.UUID
	Name                   *string
	DisplayName            *string
	Description            *string
	ControllerMachineType  *string
	InfinityResourceTypeID *uuid.UUID
	Labels                 map[string]string
	SiteID                 *uuid.UUID
	Status                 *string
	Version                *string
}

InstanceTypeUpdateInput input parameters for Update method

type InstanceUpdateInput

type InstanceUpdateInput struct {
	InstanceID                             uuid.UUID
	Name                                   *string
	Description                            *string
	TenantID                               *uuid.UUID
	InfrastructureProviderID               *uuid.UUID
	SiteID                                 *uuid.UUID
	InstanceTypeID                         *uuid.UUID
	NetworkSecurityGroupID                 *string
	NetworkSecurityGroupPropagationDetails *NetworkSecurityGroupPropagationDetails
	VpcID                                  *uuid.UUID
	MachineID                              *string
	ControllerInstanceID                   *uuid.UUID
	Hostname                               *string
	OperatingSystemID                      *uuid.UUID
	IpxeScript                             *string
	AlwaysBootWithCustomIpxe               *bool
	PhoneHomeEnabled                       *bool
	UserData                               *string
	Labels                                 map[string]string
	IsUpdatePending                        *bool
	InfinityRCRStatus                      *string
	TpmEkCertificate                       *string
	Status                                 *string
	PowerStatus                            *string
	IsMissingOnSite                        *bool
}

InstanceUpdateInput input parameters for Update method

type Interface

type Interface struct {
	bun.BaseModel `bun:"table:interface,alias:ifc"`

	ID                 uuid.UUID         `bun:"type:uuid,pk"`
	InstanceID         uuid.UUID         `bun:"instance_id,type:uuid,notnull"`
	Instance           *Instance         `bun:"rel:belongs-to,join:instance_id=id"`
	SubnetID           *uuid.UUID        `bun:"subnet_id,type:uuid"`
	Subnet             *Subnet           `bun:"rel:belongs-to,join:subnet_id=id"`
	VpcPrefixID        *uuid.UUID        `bun:"vpc_prefix_id,type:uuid"`
	VpcPrefix          *VpcPrefix        `bun:"rel:belongs-to,join:vpc_prefix_id=id"`
	MachineInterfaceID *uuid.UUID        `bun:"machine_interface_id,type:uuid"`
	MachineInterface   *MachineInterface `bun:"rel:belongs-to,join:machine_interface_id=id"`
	Device             *string           `bun:"device"`
	DeviceInstance     *int              `bun:"device_instance"`
	IsPhysical         bool              `bun:"is_physical,notnull"`
	VirtualFunctionID  *int              `bun:"virtual_function_id"`
	RequestedIpAddress *string           `bun:"requested_ip_address"`
	MacAddress         *string           `bun:"mac_address"`
	IPAddresses        []string          `bun:"ip_addresses,type:text[]"`
	Status             string            `bun:"status,notnull"`
	Created            time.Time         `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated            time.Time         `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted            *time.Time        `bun:"deleted,soft_delete"`
	CreatedBy          uuid.UUID         `bun:"type:uuid,notnull"`
}

Interface table maintains association between an instance and a subnet

func TestBuildInterface

func TestBuildInterface(t *testing.T, dbSession *db.Session, ins *Instance, sbID *uuid.UUID, vpID *uuid.UUID, isPhysical bool, status string) *Interface

TestBuildInterface creates a test interface

func (*Interface) BeforeAppendModel

func (ifc *Interface) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*Interface) BeforeCreateTable

func (it *Interface) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type InterfaceClearInput

type InterfaceClearInput struct {
	InterfaceID        uuid.UUID
	RequestedIpAddress bool
}

InterfaceClearInput input parameters for Clear method

type InterfaceCreateInput

type InterfaceCreateInput struct {
	InstanceID         uuid.UUID
	SubnetID           *uuid.UUID
	VpcPrefixID        *uuid.UUID
	IsPhysical         bool
	Device             *string
	DeviceInstance     *int
	VirtualFunctionID  *int
	RequestedIpAddress *string
	Status             string
	CreatedBy          uuid.UUID
}

InterfaceCreateInput input parameters for Create method

type InterfaceDAO

type InterfaceDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input InterfaceCreateInput) (*Interface, error)
	//
	CreateMultiple(ctx context.Context, tx *db.Tx, inputs []InterfaceCreateInput) ([]Interface, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Interface, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter InterfaceFilterInput, page paginator.PageInput, includeRelations []string) ([]Interface, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input InterfaceUpdateInput) (*Interface, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input InterfaceClearInput) (*Interface, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
	//
	DeleteAllByInstanceIDs(ctx context.Context, tx *db.Tx, instanceIDs []uuid.UUID) error
}

InterfaceDAO is an interface for interacting with the Interface model

func NewInterfaceDAO

func NewInterfaceDAO(dbSession *db.Session) InterfaceDAO

NewInterfaceDAO returns a new InterfaceDAO

type InterfaceFilterInput

type InterfaceFilterInput struct {
	InstanceIDs    []uuid.UUID
	SubnetID       *uuid.UUID
	VpcPrefixID    *uuid.UUID
	Device         *string
	DeviceInstance *int
	IsPhysical     *bool
	Statuses       []string
	IPAddresses    []string
}

InterfaceFilterInput input parameters for Filter method

type InterfaceSQLDAO

type InterfaceSQLDAO struct {
	InterfaceDAO
	// contains filtered or unexported fields
}

InterfaceSQLDAO is an implementation of the InterfaceDAO interface

func (InterfaceSQLDAO) Clear

func (ifcd InterfaceSQLDAO) Clear(ctx context.Context, tx *db.Tx, input InterfaceClearInput) (*Interface, error)

Clear sets parameters of an existing Interface to null values in db. Since there are 2 operations (UPDATE, SELECT), this must be within a transaction.

func (InterfaceSQLDAO) Create

func (ifcd InterfaceSQLDAO) Create(ctx context.Context, tx *db.Tx, input InterfaceCreateInput) (*Interface, error)

Create creates a new Interface from the given parameters

func (InterfaceSQLDAO) CreateMultiple

func (ifcd InterfaceSQLDAO) CreateMultiple(ctx context.Context, tx *db.Tx, inputs []InterfaceCreateInput) ([]Interface, error)

CreateMultiple creates multiple Interfaces from the given parameters

func (InterfaceSQLDAO) Delete

func (ifcd InterfaceSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes an Interface by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned

func (InterfaceSQLDAO) DeleteAllByInstanceIDs

func (ifcd InterfaceSQLDAO) DeleteAllByInstanceIDs(ctx context.Context, tx *db.Tx, instanceIDs []uuid.UUID) error

DeleteAllByInstanceIDs soft-deletes every Interface whose instance id is in the provided list. error is returned only if there is a db error

func (InterfaceSQLDAO) GetAll

func (ifcd InterfaceSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter InterfaceFilterInput, page paginator.PageInput, includeRelations []string) ([]Interface, int, error)

GetAll returns all Interfaces errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in InterfaceOrderByDefault in ascending order

func (InterfaceSQLDAO) GetByID

func (ifcd InterfaceSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Interface, error)

GetByID returns a Interface by ID returns db.ErrDoesNotExist error if the record is not found

func (InterfaceSQLDAO) Update

func (ifcd InterfaceSQLDAO) Update(ctx context.Context, tx *db.Tx, input InterfaceUpdateInput) (*Interface, error)

Update updates specified fields of an existing Interface The updated fields are assumed to be set to non-null values

type InterfaceUpdateInput

type InterfaceUpdateInput struct {
	InterfaceID        uuid.UUID
	InstanceID         *uuid.UUID
	SubnetID           *uuid.UUID
	VpcPrefixID        *uuid.UUID
	Device             *string
	DeviceInstance     *int
	VirtualFunctionID  *int
	RequestedIpAddress *string
	MacAddress         *string
	IpAddresses        []string
	Status             *string
}

InterfaceUpdateInput input parameters for Update method

type Labels added in v1.6.0

type Labels map[string]string

Labels is the canonical entity-side representation of a workflow `Metadata.Labels` list — a key/value map that can be round-tripped through `ToProto` / `FromProtoMetadata` without losing the empty vs. nil distinction. Defining a named type lets us hang the proto conversion on it as a method (`labels.ToProto()`) rather than keeping a free function in this package.

func (*Labels) FromProto added in v1.6.0

func (l *Labels) FromProto(protoLabels []*cwssaws.Label)

FromProto populates the receiver from a workflow proto repeated Label representation, mirroring `(Labels).ToProto()`. A nil input clears the receiver to nil; a non-nil but empty input yields a non-nil empty map, so callers can distinguish "no labels reported" from "labels explicitly cleared". Entries with an empty key are skipped; a label with a nil value resolves to an empty string.

func (Labels) ToProto added in v1.6.0

func (l Labels) ToProto() []*cwssaws.Label

ToProto converts the labels into the workflow proto repeated Label representation. Returns nil for a nil map; an empty map yields a non-nil empty slice so callers can distinguish "labels explicitly cleared" from "no labels at all".

type Machine

type Machine struct {
	bun.BaseModel `bun:"table:machine,alias:m"`

	ID                       string                  `bun:"id,pk"`
	InfrastructureProviderID uuid.UUID               `bun:"infrastructure_provider_id,type:uuid,notnull"`
	InfrastructureProvider   *InfrastructureProvider `bun:"rel:belongs-to,join:infrastructure_provider_id=id"`
	SiteID                   uuid.UUID               `bun:"site_id,type:uuid,notnull"`
	Site                     *Site                   `bun:"rel:belongs-to,join:site_id=id"`
	InstanceTypeID           *uuid.UUID              `bun:"instance_type_id,type:uuid"`
	InstanceType             *InstanceType           `bun:"rel:belongs-to,join:instance_type_id=id"`
	ControllerMachineID      string                  `bun:"controller_machine_id,notnull"`
	ControllerMachineType    *string                 `bun:"controller_machine_type"`
	HwSkuDeviceType          *string                 `bun:"hw_sku_device_type"`
	Vendor                   *string                 `bun:"vendor"`
	ProductName              *string                 `bun:"product_name"`
	SerialNumber             *string                 `bun:"serial_number"`
	Metadata                 *SiteControllerMachine  `bun:"metadata,type:jsonb"`
	IsInMaintenance          bool                    `bun:"is_in_maintenance,notnull"`
	// IsUsableByTenant indicates whether this machine can be used by tenants
	// Note: The database also has a deprecated is_allocatable column (not exposed in this model)
	// that will be removed in a future migration after all services migrate to this field
	IsUsableByTenant     bool                   `bun:"is_usable_by_tenant,notnull"`
	MaintenanceMessage   *string                `bun:"maintenance_message"`
	IsNetworkDegraded    bool                   `bun:"is_network_degraded,notnull"`
	NetworkHealthMessage *string                `bun:"network_health_message"`
	Health               map[string]interface{} `bun:"health,type:jsonb,json_use_number"`
	DefaultMacAddress    *string                `bun:"default_mac_address"`
	Hostname             *string                `bun:"hostname"`
	IsAssigned           bool                   `bun:"is_assigned,notnull"` // true when machine is assigned to an Instance
	Labels               map[string]string      `bun:"labels,type:jsonb"`   // Labels are used to store additional metadata about the machine
	Status               string                 `bun:"status,notnull"`
	IsMissingOnSite      bool                   `bun:"is_missing_on_site,notnull"`
	Created              time.Time              `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated              time.Time              `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted              *time.Time             `bun:"deleted,soft_delete"`
}

Machine is the baremetal server that sits in the datacenter

func TestBuildMachine

func TestBuildMachine(t *testing.T, dbSession *db.Session, ip *InfrastructureProvider, site *Site, instanceType *InstanceType, controllerMachineType *string) *Machine

TestBuildMachine creates a test Machine

func (*Machine) BeforeAppendModel

func (m *Machine) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*Machine) BeforeCreateTable

func (m *Machine) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created This is only used in tests

func (*Machine) GetControllerState

func (m *Machine) GetControllerState() string

GetControllerState returns the normalized controller state from Machine metadata, or empty when metadata is nil.

func (*Machine) GetHealth

func (m *Machine) GetHealth() (*MachineHealth, error)

returns db.ErrDoesNotExist error if the record is not found

func (*Machine) GetIndentedJSON

func (m *Machine) GetIndentedJSON() ([]byte, error)

GetIndentedJSON returns formatted json of Machine

type MachineCapability

type MachineCapability struct {
	bun.BaseModel `bun:"table:machine_capability,alias:mc"`

	ID               uuid.UUID              `bun:"type:uuid,pk"`
	MachineID        *string                `bun:"machine_id"`
	InstanceTypeID   *uuid.UUID             `bun:"instance_type_id,type:uuid"`
	InstanceType     *InstanceType          `bun:"rel:belongs-to,join:instance_type_id=id"`
	Type             string                 `bun:"type,notnull"`
	Name             string                 `bun:"name,notnull"`
	Frequency        *string                `bun:"frequency"`
	Capacity         *string                `bun:"capacity"`
	HardwareRevision *string                `bun:"hardware_revision"`
	Cores            *int                   `bun:"cores"`
	Threads          *int                   `bun:"threads"`
	Vendor           *string                `bun:"vendor"`
	Count            *int                   `bun:"count"`
	DeviceType       *string                `bun:"device_type"`
	InactiveDevices  []int                  `bun:"inactive_devices"`
	Index            int                    `bun:"index"`
	Info             map[string]interface{} `bun:"info,json_use_number"` // Any other attribute of the capability
	Created          time.Time              `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated          time.Time              `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted          *time.Time             `bun:"deleted,soft_delete"`

	// Deprecated fields: To be deleted
	ValueStr    *string `bun:"value_str"`
	ValueInt    *int    `bun:"value_int"`
	Description *string `bun:"description"`
}

MachineCapability represents entries in the machine_capability table It describes capabilities of a Machine

func (*MachineCapability) BeforeAppendModel

func (mc *MachineCapability) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*MachineCapability) BeforeCreateTable

func (mc *MachineCapability) BeforeCreateTable(ctx context.Context,
	query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created This is only used in tests

func (*MachineCapability) GetIndentedJSON

func (mc *MachineCapability) GetIndentedJSON() ([]byte, error)

GetIndentedJSON returns formatted json of MachineCapability

func (*MachineCapability) GetIntInfo

func (mc *MachineCapability) GetIntInfo(name string) *int

GetIntInfo returns the integer value of the given key in the Info map

func (*MachineCapability) GetStrInfo

func (mc *MachineCapability) GetStrInfo(name string) *string

GetStrInfo returns the string value of the given key in the Info map

func (*MachineCapability) ToProto added in v1.6.0

ToProto converts this MachineCapability to its workflow proto representation used in InstanceType filter attributes.

Per the proto-conversion convention, this is a pure mapper and does not return errors. An unknown Type leaves the proto's CapabilityType as the zero enum value with a warning logged; an unknown DeviceType is dropped to nil. Numeric width casts are inline and rely on request-side `Validate` having bounded the values to uint32 before they ever reach the DB.

The string-to-enum mappings are inlined as switches because the underlying DB columns are plain strings — there is no `MachineCapabilityType` Go type to hang a method on. If those columns ever become typed-string enums, this is the natural place to swap to `mc.Type.ToProto()`.

type MachineCapabilityCreateInput

type MachineCapabilityCreateInput struct {
	MachineID        *string
	InstanceTypeID   *uuid.UUID
	Type             string
	Name             string
	Frequency        *string
	Capacity         *string
	HardwareRevision *string
	Cores            *int
	Threads          *int
	Vendor           *string
	Count            *int
	DeviceType       *string
	InactiveDevices  []int
	Index            int
	Info             map[string]interface{}
}

MachineCapabilityCreateInput input parameters for Create method

type MachineCapabilityDAO

type MachineCapabilityDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input MachineCapabilityCreateInput) (*MachineCapability, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*MachineCapability, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, machineIDs []string, instanceTypeIDs []uuid.UUID, capabilityType *string,
		name *string, frequency *string, capacity *string, vendor *string,
		count *int, deviceType *string, inactiveDevices []int, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]MachineCapability, int, error)
	//
	GetAllDistinct(ctx context.Context, tx *db.Tx, machineIDs []string, instanceTypeID *uuid.UUID, capabilityType *string,
		name *string, frequency *string, capacity *string, vendor *string,
		count *int, deviceType *string, inactiveDevices []int, offset *int, limit *int, orderBy *paginator.OrderBy) ([]MachineCapability, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input MachineCapabilityUpdateInput) (*MachineCapability, error)
	//
	ClearFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID,
		machineID, instanceTypeID, frequency, capacity, vendor, info bool) (*MachineCapability, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID, purge bool) error
}

MachineCapabilityDAO is an interface for interacting with the MachineCapability model

func NewMachineCapabilityDAO

func NewMachineCapabilityDAO(dbSession *db.Session) MachineCapabilityDAO

NewMachineCapabilityDAO returns a new MachineCapabilityDAO

type MachineCapabilitySQLDAO

type MachineCapabilitySQLDAO struct {
	MachineCapabilityDAO
	// contains filtered or unexported fields
}

MachineCapabilitySQLDAO is an implementation of the MachineCapabilityDAO interface

func (MachineCapabilitySQLDAO) ClearFromParams

func (mcd MachineCapabilitySQLDAO) ClearFromParams(
	ctx context.Context, tx *db.Tx,
	id uuid.UUID,
	machineID, instanceTypeID, frequency, capacity, vendor, info bool) (*MachineCapability, error)

ClearFromParams sets parameters of an existing Machine Capability to null values in db since there are 2 operations (UPDATE, SELECT), it is required that this must be within a transaction

func (MachineCapabilitySQLDAO) Create

CreateFromParams creates a new MachineCapability from the given parameters The returned MachineCapability will not have any related structs filled in since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (MachineCapabilitySQLDAO) DeleteByID

func (mcd MachineCapabilitySQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID, purge bool) error

DeleteByID deletes an MachineCapability by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (MachineCapabilitySQLDAO) GetAll

func (mcd MachineCapabilitySQLDAO) GetAll(
	ctx context.Context, tx *db.Tx,
	machineIDs []string,
	instanceTypeIDs []uuid.UUID,
	capabilityType *string,
	name *string,
	frequency *string,
	capacity *string,
	vendor *string,
	count *int,
	deviceType *string,
	inactiveDevices []int,
	includeRelations []string,
	offset *int, limit *int, orderBy *paginator.OrderBy) ([]MachineCapability, int, error)

GetAll returns all MachineCapabilities filtered by the given parameters if orderBy is nil, then records are ordered by column specified in MachineCapabilityOrderByDefault in ascending order

func (MachineCapabilitySQLDAO) GetAllDistinct

func (mcd MachineCapabilitySQLDAO) GetAllDistinct(
	ctx context.Context, tx *db.Tx,
	machineIDs []string,
	instanceTypeID *uuid.UUID,
	capabilityType *string,
	name *string,
	frequency *string,
	capacity *string,
	vendor *string,
	count *int,
	deviceType *string,
	inactiveDevices []int,
	offset *int, limit *int, orderBy *paginator.OrderBy) ([]MachineCapability, int, error)

GetAllDistinct returns all MachineCapabilities that have distinct type, name, frequency, capacity, vendor, count, and device_type filtered by the given parameters

func (MachineCapabilitySQLDAO) GetByID

func (mcd MachineCapabilitySQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*MachineCapability, error)

GetByID returns a MachineCapability by ID returns db.ErrDoesNotExist error if the record is not found

func (MachineCapabilitySQLDAO) Update

Update updates specified fields of an existing MachineCapability The updated fields are assumed to be set to non-null values since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

type MachineCapabilityUpdateInput

type MachineCapabilityUpdateInput struct {
	ID               uuid.UUID
	MachineID        *string
	InstanceTypeID   *uuid.UUID
	Type             *string
	Name             *string
	Frequency        *string
	Capacity         *string
	HardwareRevision *string
	Cores            *int
	Threads          *int
	Vendor           *string
	Count            *int
	DeviceType       *string
	InactiveDevices  []int
	Index            *int
	Info             map[string]interface{}
}

MachineCapabilityUpdateInput input parameters for Update method

type MachineClearInput

type MachineClearInput struct {
	MachineID             string
	InstanceTypeID        bool
	ControllerMachineType bool
	HwSkuDeviceType       bool
	Vendor                bool
	ProductName           bool
	SerialNumber          bool
	Metadata              bool
	MaintenanceMessage    bool
	Health                bool
	NetworkHealthMessage  bool
	DefaultMacAddress     bool
	Hostname              bool
}

MachineClearInput input parameters for Clear method

type MachineCreateInput

type MachineCreateInput struct {
	MachineID                string
	InfrastructureProviderID uuid.UUID
	SiteID                   uuid.UUID
	InstanceTypeID           *uuid.UUID
	ControllerMachineID      string
	ControllerMachineType    *string
	HwSkuDeviceType          *string
	Vendor                   *string
	ProductName              *string
	SerialNumber             *string
	Metadata                 *SiteControllerMachine
	IsInMaintenance          bool
	IsUsableByTenant         bool
	MaintenanceMessage       *string
	IsNetworkDegraded        bool
	NetworkHealthMessage     *string
	Health                   map[string]interface{}
	DefaultMacAddress        *string
	Hostname                 *string
	Status                   string
	Labels                   map[string]string
}

MachineCreateInput input parameters for Create method

type MachineDAO

type MachineDAO interface {
	// Create used to create new row
	Create(ctx context.Context, tx *db.Tx, input MachineCreateInput) (*Machine, error)
	// Update used to update row
	Update(ctx context.Context, tx *db.Tx, input MachineUpdateInput) (*Machine, error)
	// UpdateMultiple used to update multiple rows
	UpdateMultiple(ctx context.Context, tx *db.Tx, inputs []MachineUpdateInput) ([]Machine, error)
	// Delete used to delete row
	Delete(ctx context.Context, tx *db.Tx, machineID string, purge bool) error
	// Clear used to clear fields in the row
	Clear(ctx context.Context, tx *db.Tx, input MachineClearInput) (*Machine, error)
	// GetAll returns all the rows based on the filter and page inputs
	GetAll(ctx context.Context, tx *db.Tx, filter MachineFilterInput, page paginator.PageInput, includeRelations []string) ([]Machine, int, error)
	// GetByID returns row for specified ID
	GetByID(ctx context.Context, tx *db.Tx, machineID string, includeRelations []string, forUpdate bool) (*Machine, error)
	// GetCountByStatus returns row counts per status
	GetCountByStatus(ctx context.Context, tx *db.Tx, infrastructureProviderID *uuid.UUID, siteID *uuid.UUID, instanceTypeID *uuid.UUID) (map[string]int, error)
	// GetCount returns total count of rows for specified filter
	GetCount(ctx context.Context, tx *db.Tx, filter MachineFilterInput) (count int, err error)
	// GetHealth returns the machine's health deserialized from json
	GetHealth(ctx context.Context, tx *db.Tx, machineID string, includeRelations []string) (*MachineHealth, error)
}

MachineDAO is an interface for interacting with the Machine model

func NewMachineDAO

func NewMachineDAO(dbSession *db.Session) MachineDAO

NewMachineDAO returns a new MachineDAO

type MachineFilterInput

type MachineFilterInput struct {
	InfrastructureProviderIDs []uuid.UUID
	SiteIDs                   []uuid.UUID
	HasInstanceType           *bool
	InstanceTypeIDs           []uuid.UUID
	ControllerMachineID       *string
	HwSkuDeviceTypes          []string
	IsAssigned                *bool
	Hostname                  *string
	CapabilityType            *string
	CapabilityNames           []string
	Statuses                  []string
	SearchQuery               *string
	MachineIDs                []string
	IsMissingOnSite           *bool
	ExcludeMetadata           bool // When true, excludes the metadata JSONB column from SELECT to improve performance on bulk queries
}

MachineFilterInput filtering options for GetAll method

type MachineHealth

type MachineHealth struct {
	Source     string               `json:"source"`
	ObservedAt *string              `json:"observed_at"`
	Successes  []HealthProbeSuccess `json:"successes"`
	Alerts     []HealthProbeAlert   `json:"alerts"`
}

func (*MachineHealth) HasAlertID added in v1.6.0

func (h *MachineHealth) HasAlertID(alertID string) bool

HasAlertID reports whether Alerts contains an entry with Id equal to alertID.

type MachineInstanceType

type MachineInstanceType struct {
	bun.BaseModel `bun:"table:machine_instance_type,alias:mit"`

	ID             uuid.UUID     `bun:"type:uuid,pk"`
	MachineID      string        `bun:"machine_id,notnull"`
	Machine        *Machine      `bun:"rel:belongs-to,join:machine_id=id"`
	InstanceTypeID uuid.UUID     `bun:"instance_type_id,type:uuid,notnull"`
	InstanceType   *InstanceType `bun:"rel:belongs-to,join:instance_type_id=id"`
	Created        time.Time     `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated        time.Time     `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted        *time.Time    `bun:"deleted,soft_delete"`
}

MachineInstanceType represents entries in the machine_instance_type table It associates a Machine to a particular Instance Type

func TestBuildMachineInstanceType

func TestBuildMachineInstanceType(t *testing.T, dbSession *db.Session, machine *Machine, instanceType *InstanceType) *MachineInstanceType

TestBuildMachineInstanceType creates a test Machine/Instance Type association

func (*MachineInstanceType) BeforeAppendModel

func (mit *MachineInstanceType) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*MachineInstanceType) BeforeCreateTable

func (mi *MachineInstanceType) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created This is only used in tests

func (*MachineInstanceType) GetIndentedJSON

func (mi *MachineInstanceType) GetIndentedJSON() ([]byte, error)

GetIndentedJSON returns formatted json of MachineInstanceType

func (*MachineInstanceType) ToRemoveAssociationRequestProto added in v1.6.0

func (mit *MachineInstanceType) ToRemoveAssociationRequestProto() *cwssaws.RemoveMachineInstanceTypeAssociationRequest

ToRemoveAssociationRequestProto builds the workflow request used to dissociate this Machine from its current InstanceType. The proto only carries the Machine ID; site-side reconciliation handles the rest.

type MachineInstanceTypeDAO

type MachineInstanceTypeDAO interface {
	//
	CreateFromParams(ctx context.Context, tx *db.Tx, machineID string, instanceTypeID uuid.UUID) (*MachineInstanceType, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*MachineInstanceType, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, machineID *string, instanceTypeID []uuid.UUID, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]MachineInstanceType, int, error)
	//
	UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, machineID *string, instanceTypeID *uuid.UUID) (*MachineInstanceType, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID, purge bool) error
	//
	DeleteAllByInstanceTypeID(ctx context.Context, tx *db.Tx, instanceTypeID uuid.UUID, purge bool) error
}

MachineInstanceTypeDAO is an interface for interacting with the MachineInstanceType model

func NewMachineInstanceTypeDAO

func NewMachineInstanceTypeDAO(dbSession *db.Session) MachineInstanceTypeDAO

NewMachineInstanceTypeDAO creates a new NewMachineInstanceTypeDAO

type MachineInstanceTypeSQLDAO

type MachineInstanceTypeSQLDAO struct {
	MachineInstanceTypeDAO
	// contains filtered or unexported fields
}

MachineInstanceTypeSQLDAO is an implementation of the MachineInstanceTypeDAO interface

func (MachineInstanceTypeSQLDAO) CreateFromParams

func (mitsd MachineInstanceTypeSQLDAO) CreateFromParams(
	ctx context.Context, tx *db.Tx,
	machineID string,
	instanceTypeID uuid.UUID) (*MachineInstanceType, error)

CreateFromParams creates a new MachineInstanceType from the given parameters The returned MachineInstanceType will not have any related structs (InstanceTypeID) filled in since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (MachineInstanceTypeSQLDAO) DeleteAllByInstanceTypeID

func (mitsd MachineInstanceTypeSQLDAO) DeleteAllByInstanceTypeID(ctx context.Context, tx *db.Tx, instanceTypeID uuid.UUID, purge bool) error

DeleteAllByInstanceTypeID deletes all MachineInstanceTypes for a given InstanceType error is returned only if there is a db error

func (MachineInstanceTypeSQLDAO) DeleteByID

func (mitsd MachineInstanceTypeSQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID, purge bool) error

DeleteByID deletes an MachineInstanceType by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (MachineInstanceTypeSQLDAO) GetAll

func (mitsd MachineInstanceTypeSQLDAO) GetAll(ctx context.Context, tx *db.Tx, machineID *string, instanceTypeIDs []uuid.UUID, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]MachineInstanceType, int, error)

GetAll returns all MachineInstanceTypes for an InstanceType Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in MachineInstanceTypeOrderByDefault in ascending order

func (MachineInstanceTypeSQLDAO) GetByID

func (mitsd MachineInstanceTypeSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*MachineInstanceType, error)

GetByID returns a MachineInstanceType by ID returns db.ErrDoesNotExist error if the record is not found

func (MachineInstanceTypeSQLDAO) UpdateFromParams

func (mitsd MachineInstanceTypeSQLDAO) UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, machineID *string, instanceTypeID *uuid.UUID) (*MachineInstanceType, error)

UpdateFromParams updates specified fields of an existing MachineInstanceType The updated fields are assumed to be set to non-null values since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

type MachineInterface

type MachineInterface struct {
	bun.BaseModel `bun:"table:machine_interface,alias:mi"`

	ID                    uuid.UUID  `bun:"type:uuid,pk"`
	MachineID             string     `bun:"machine_id,notnull"`
	Machine               *Machine   `bun:"rel:belongs-to,join:machine_id=id"`
	ControllerInterfaceID *uuid.UUID `bun:"controller_interface_id,type:uuid"`
	ControllerSegmentID   *uuid.UUID `bun:"controller_segment_id,type:uuid"`
	AttachedDPUMachineID  *string    `bun:"attached_dpu_machine_id"`
	SubnetID              *uuid.UUID `bun:"subnet_id,type:uuid"`
	Subnet                *Subnet    `bun:"rel:belongs-to,join:subnet_id=id"`
	Hostname              *string    `bun:"hostname"`
	IsPrimary             bool       `bun:"is_primary,notnull"`
	MacAddress            *string    `bun:"mac_address"`
	IPAddresses           []string   `bun:"ip_addresses,notnull,array"`
	Created               time.Time  `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated               time.Time  `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted               *time.Time `bun:"deleted,soft_delete"`
}

MachineInterface tracks the interfaces of a machine

func (*MachineInterface) BeforeAppendModel

func (mi *MachineInterface) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*MachineInterface) BeforeCreateTable

func (mc *MachineInterface) BeforeCreateTable(ctx context.Context,
	query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type MachineInterfaceClearInput

type MachineInterfaceClearInput struct {
	MachineInterfaceID    uuid.UUID
	ControllerInterfaceID bool
	ControllerSegmentID   bool
	AttachedDpuMachineID  bool
	SubnetID              bool
	Hostname              bool
	MacAddress            bool
}

MachineInterfaceClearInput input parameters for Clear method

type MachineInterfaceCreateInput

type MachineInterfaceCreateInput struct {
	MachineInterfaceID    *uuid.UUID
	MachineID             string
	ControllerInterfaceID *uuid.UUID
	ControllerSegmentID   *uuid.UUID
	AttachedDpuMachineID  *string
	SubnetID              *uuid.UUID
	Hostname              *string
	IsPrimary             bool
	MacAddress            *string
	IpAddresses           []string
}

MachineInterfaceCreateInput input parameters for Create method

type MachineInterfaceDAO

type MachineInterfaceDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input MachineInterfaceCreateInput) (*MachineInterface, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID,
		includeRelations []string) (*MachineInterface, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter MachineInterfaceFilterInput, page paginator.PageInput, includeRelations []string) ([]MachineInterface, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input MachineInterfaceUpdateInput) (*MachineInterface, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input MachineInterfaceClearInput) (*MachineInterface, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID, purge bool) error
}

MachineInterfaceDAO is an interface for interacting with the MachineInterface model

func NewMachineInterfaceDAO

func NewMachineInterfaceDAO(dbSession *db.Session) MachineInterfaceDAO

NewMachineInterfaceDAO returns a new MachineInterfaceDAO

type MachineInterfaceFilterInput

type MachineInterfaceFilterInput struct {
	MachineIDs             []string
	ControllerInterfaceIDs []uuid.UUID
	ControllerSegmentIDs   []uuid.UUID
	AttachedDpuMachineIDs  []string
	SubnetIDs              []uuid.UUID
	Hostnames              []string
	IsPrimary              *bool
	MacAddresses           []string
	IpAddresses            []string
}

MachineInterfaceFilterInput input parameters for Filter method

type MachineInterfaceSQLDAO

type MachineInterfaceSQLDAO struct {
	MachineInterfaceDAO
	// contains filtered or unexported fields
}

MachineInterfaceSQLDAO is an implementation of the MachineInterfaceDAO interface

func (MachineInterfaceSQLDAO) Clear

ClearFromParams sets parameters of an existing Machine Capability to null values in db since there are 2 operations (UPDATE, SELECT), it is required that this must be within a transaction

func (MachineInterfaceSQLDAO) Create

CreateFromParams creates a new MachineInterface from the given parameters The returned MachineInterface will not have any related structs filled in

func (MachineInterfaceSQLDAO) Delete

func (micd MachineInterfaceSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID, purge bool) error

Delete deletes an MachineInterface by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (MachineInterfaceSQLDAO) GetAll

func (micd MachineInterfaceSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter MachineInterfaceFilterInput, page paginator.PageInput, includeRelations []string) ([]MachineInterface, int, error)

GetAll returns all MachineInterfaces for an InstanceType Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in MachineInterfaceOrderByDefault in ascending order

func (MachineInterfaceSQLDAO) GetByID

func (micd MachineInterfaceSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID,
	includeRelations []string) (*MachineInterface, error)

GetByID returns a MachineInterface by ID returns db.ErrDoesNotExist error if the record is not found

func (MachineInterfaceSQLDAO) Update

UpdateFromParams updates specified fields of an existing MachineInterface The updated fields are assumed to be set to non-null values

type MachineInterfaceUpdateInput

type MachineInterfaceUpdateInput struct {
	MachineInterfaceID    uuid.UUID
	MachineID             *string
	ControllerInterfaceID *uuid.UUID
	ControllerSegmentID   *uuid.UUID
	AttachedDpuMachineID  *string
	SubnetID              *uuid.UUID
	Hostname              *string
	IsPrimary             *bool
	MacAddress            *string
	IpAddresses           []string
}

MachineInterfaceUpdateInput input parameters for Update method

type MachineSQLDAO

type MachineSQLDAO struct {
	MachineDAO
	// contains filtered or unexported fields
}

MachineSQLDAO is an implementation of the MachineDAO interface

func (MachineSQLDAO) Clear

func (msd MachineSQLDAO) Clear(ctx context.Context, tx *db.Tx, input MachineClearInput) (*Machine, error)

Clear sets parameters of an existing Machine to null values in db since there are 2 operations (UPDATE, SELECT), it is required that this must be within a transaction

func (MachineSQLDAO) Create

func (msd MachineSQLDAO) Create(ctx context.Context, tx *db.Tx, input MachineCreateInput) (*Machine, error)

Create creates a new Machine from the given parameters The returned Machine will not have any related structs filled in since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (MachineSQLDAO) Delete

func (msd MachineSQLDAO) Delete(ctx context.Context, tx *db.Tx, machineID string, purge bool) error

Delete deletes an Machine by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (MachineSQLDAO) GetAll

func (msd MachineSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter MachineFilterInput, page paginator.PageInput, includeRelations []string) ([]Machine, int, error)

GetAll returns all Machines based on the filter and paging Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in MachineOrderByDefault in ascending order

func (MachineSQLDAO) GetByID

func (msd MachineSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id string, includeRelations []string, forUpdate bool) (*Machine, error)

GetByID returns a Machine by ID returns db.ErrDoesNotExist error if the record is not found

func (MachineSQLDAO) GetCount

func (msd MachineSQLDAO) GetCount(ctx context.Context, tx *db.Tx, filter MachineFilterInput) (count int, err error)

func (MachineSQLDAO) GetCountByStatus

func (msd MachineSQLDAO) GetCountByStatus(ctx context.Context, tx *db.Tx, infrastructureProviderID *uuid.UUID, siteID *uuid.UUID, instanceTypeID *uuid.UUID) (map[string]int, error)

GetCountByStatus returns count of Machines for given status Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned map is 0

func (MachineSQLDAO) Update

func (msd MachineSQLDAO) Update(ctx context.Context, tx *db.Tx, input MachineUpdateInput) (*Machine, error)

Update updates specified fields of an existing Machine The updated fields are assumed to be set to non-null values since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

func (MachineSQLDAO) UpdateMultiple

func (msd MachineSQLDAO) UpdateMultiple(ctx context.Context, tx *db.Tx, inputs []MachineUpdateInput) ([]Machine, error)

UpdateMultiple updates multiple Machines with the given parameters using a single bulk UPDATE query All inputs should update the same set of fields for optimal performance The updated fields are assumed to be set to non-null values since there are 2 operations (UPDATE, SELECT), it is required that this library call happens within a transaction

type MachineUpdateInput

type MachineUpdateInput struct {
	MachineID                string
	InfrastructureProviderID *uuid.UUID
	SiteID                   *uuid.UUID
	InstanceTypeID           *uuid.UUID
	ControllerMachineID      *string
	ControllerMachineType    *string
	HwSkuDeviceType          *string
	Vendor                   *string
	ProductName              *string
	SerialNumber             *string
	Metadata                 *SiteControllerMachine
	IsInMaintenance          *bool
	IsUsableByTenant         *bool
	MaintenanceMessage       *string
	IsNetworkDegraded        *bool
	NetworkHealthMessage     *string
	Health                   map[string]interface{}
	DefaultMacAddress        *string
	Hostname                 *string
	IsAssigned               *bool
	Status                   *string
	Labels                   map[string]string
	IsMissingOnSite          *bool
}

MachineUpdateInput input parameters for Update method

type NVLinkInterface

type NVLinkInterface struct {
	bun.BaseModel `bun:"table:nvlink_interface,alias:nvli"`

	ID                       uuid.UUID               `bun:"type:uuid,pk"`
	InstanceID               uuid.UUID               `bun:"instance_id,type:uuid,notnull"`
	Instance                 *Instance               `bun:"rel:belongs-to,join:instance_id=id"`
	SiteID                   uuid.UUID               `bun:"site_id,type:uuid,notnull"`
	Site                     *Site                   `bun:"rel:belongs-to,join:site_id=id"`
	NVLinkLogicalPartitionID uuid.UUID               `bun:"nvlink_logical_partition_id,type:uuid,notnull"`
	NVLinkLogicalPartition   *NVLinkLogicalPartition `bun:"rel:belongs-to,join:nvlink_logical_partition_id=id"`
	NVLinkDomainID           *uuid.UUID              `bun:"nvlink_domain_id,type:uuid"`
	Device                   *string                 `bun:"device"`
	DeviceInstance           int                     `bun:"device_instance,notnull"`
	GpuGUID                  *string                 `bun:"gpu_guid"`
	Status                   string                  `bun:"status,notnull"`
	Created                  time.Time               `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                  time.Time               `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                  *time.Time              `bun:"deleted,soft_delete"`
	CreatedBy                uuid.UUID               `bun:"type:uuid,notnull"`
}

NVLinkInterface represents entries in the NVLinkInterface table

func (*NVLinkInterface) BeforeAppendModel

func (nvli *NVLinkInterface) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*NVLinkInterface) BeforeCreateTable

func (ibi *NVLinkInterface) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type NVLinkInterfaceClearInput

type NVLinkInterfaceClearInput struct {
	NVLinkInterfaceID uuid.UUID
	NVLinkDomainID    bool
	Device            bool
	GpuGUID           bool
}

NVLinkInterfaceClearInput input parameters for Clear method

type NVLinkInterfaceCreateInput

type NVLinkInterfaceCreateInput struct {
	NVLinkInterfaceID        *uuid.UUID
	InstanceID               uuid.UUID
	SiteID                   uuid.UUID
	NVLinkLogicalPartitionID uuid.UUID
	Device                   *string
	DeviceInstance           int
	Status                   string
	CreatedBy                uuid.UUID
}

NVLinkInterfaceCreateInput input parameters for Create method

type NVLinkInterfaceDAO

type NVLinkInterfaceDAO interface {
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*NVLinkInterface, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter NVLinkInterfaceFilterInput, page paginator.PageInput, includeRelations []string) ([]NVLinkInterface, int, error)
	//
	Create(ctx context.Context, tx *db.Tx, input NVLinkInterfaceCreateInput) (*NVLinkInterface, error)
	//
	CreateMultiple(ctx context.Context, tx *db.Tx, inputs []NVLinkInterfaceCreateInput) ([]NVLinkInterface, error)
	//
	Update(ctx context.Context, tx *db.Tx, input NVLinkInterfaceUpdateInput) (*NVLinkInterface, error)
	//
	UpdateMultiple(ctx context.Context, tx *db.Tx, inputs []NVLinkInterfaceUpdateInput) ([]NVLinkInterface, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input NVLinkInterfaceClearInput) (*NVLinkInterface, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
	//
	DeleteAllBySiteID(ctx context.Context, tx *db.Tx, siteID uuid.UUID) error
}

NVLinkInterfaceDAO is an interface for interacting with the NVLinkInterface model

func NewNVLinkInterfaceDAO

func NewNVLinkInterfaceDAO(dbSession *db.Session) NVLinkInterfaceDAO

NewNVLinkInterfaceDAO returns a new NVLinkInterfaceDAO

type NVLinkInterfaceFilterInput

type NVLinkInterfaceFilterInput struct {
	NVLinkInterfaceIDs        []uuid.UUID
	InstanceIDs               []uuid.UUID
	SiteIDs                   []uuid.UUID
	NVLinkLogicalPartitionIDs []uuid.UUID
	NVLinkDomainIDs           []uuid.UUID
	Statuses                  []string
	Devices                   []string
	DeviceInstances           []int
	SearchQuery               *string
}

NVLinkInterfaceFilterInput input parameters for Filter method

type NVLinkInterfaceSQLDAO

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

NVLinkInterfaceSQLDAO is an implementation of the NVLinkInterfaceDAO interface

func (NVLinkInterfaceSQLDAO) Clear

Clear clears NVLinkInterface attributes based on provided arguments

func (NVLinkInterfaceSQLDAO) Create

Create creates a new NVLinkInterface from the given parameters

func (NVLinkInterfaceSQLDAO) CreateMultiple

func (nvlisd NVLinkInterfaceSQLDAO) CreateMultiple(ctx context.Context, tx *db.Tx, inputs []NVLinkInterfaceCreateInput) ([]NVLinkInterface, error)

CreateMultiple creates multiple NVLinkInterfaces from the given parameters

func (NVLinkInterfaceSQLDAO) Delete

func (nvlisd NVLinkInterfaceSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes a NVLinkInterface by ID

func (NVLinkInterfaceSQLDAO) DeleteAllBySiteID

func (nvlisd NVLinkInterfaceSQLDAO) DeleteAllBySiteID(ctx context.Context, tx *db.Tx, siteID uuid.UUID) error

DeleteAllBySiteID deletes all NVLinkInterface records for a given Site error is returned only if there is a db error

func (NVLinkInterfaceSQLDAO) GetAll

func (nvlisd NVLinkInterfaceSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter NVLinkInterfaceFilterInput, page paginator.PageInput, includeRelations []string) ([]NVLinkInterface, int, error)

GetAll returns all NVLinkInterfaces for a tenant or site Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in NVLinkInterfaceOrderByDefault in ascending order

func (NVLinkInterfaceSQLDAO) GetByID

func (nvlisd NVLinkInterfaceSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*NVLinkInterface, error)

GetByID returns a NVLinkInterface by ID

func (NVLinkInterfaceSQLDAO) Update

Update updates an existing NVLinkInterface from the given parameters

func (NVLinkInterfaceSQLDAO) UpdateMultiple

func (nvlisd NVLinkInterfaceSQLDAO) UpdateMultiple(ctx context.Context, tx *db.Tx, inputs []NVLinkInterfaceUpdateInput) ([]NVLinkInterface, error)

UpdateMultiple updates multiple NVLinkInterfaces in a single batch operation. Since there are 2 operations (UPDATE, SELECT), this method should be called within a transaction.

type NVLinkInterfaceUpdateInput

type NVLinkInterfaceUpdateInput struct {
	NVLinkInterfaceID uuid.UUID
	NVLinkDomainID    *uuid.UUID
	Device            *string
	DeviceInstance    *int
	GpuGUID           *string
	Status            *string
}

NVLinkInterfaceUpdateInput input parameters for Update method

type NVLinkLogicalPartition

type NVLinkLogicalPartition struct {
	bun.BaseModel `bun:"table:nvlink_logical_partition,alias:nvllp"`

	ID              uuid.UUID  `bun:"type:uuid,pk"`
	Name            string     `bun:"name,notnull"`
	Description     *string    `bun:"description"`
	Org             string     `bun:"org,notnull"`
	SiteID          uuid.UUID  `bun:"site_id,type:uuid,notnull"`
	Site            *Site      `bun:"rel:belongs-to,join:site_id=id"`
	TenantID        uuid.UUID  `bun:"tenant_id,type:uuid,notnull"`
	Tenant          *Tenant    `bun:"rel:belongs-to,join:tenant_id=id"`
	Status          string     `bun:"status,notnull"`
	IsMissingOnSite bool       `bun:"is_missing_on_site,notnull"`
	Created         time.Time  `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated         time.Time  `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted         *time.Time `bun:"deleted,soft_delete"`
	CreatedBy       uuid.UUID  `bun:"type:uuid,notnull"`
}

NVLinkLogicalPartition represents entries in the NVLinkLogicalPartition table

func (*NVLinkLogicalPartition) BeforeAppendModel

func (nvllp *NVLinkLogicalPartition) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*NVLinkLogicalPartition) BeforeCreateTable

func (nvllp *NVLinkLogicalPartition) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type NVLinkLogicalPartitionClearInput

type NVLinkLogicalPartitionClearInput struct {
	NVLinkLogicalPartitionID uuid.UUID
	Description              bool
}

NVLinkLogicalPartitionClearInput input parameters for Clear method

type NVLinkLogicalPartitionCreateInput

type NVLinkLogicalPartitionCreateInput struct {
	NVLinkLogicalPartitionID *uuid.UUID
	Name                     string
	Description              *string
	TenantOrg                string
	SiteID                   uuid.UUID
	TenantID                 uuid.UUID
	Status                   string
	CreatedBy                uuid.UUID
}

NVLinkLogicalPartitionCreateInput input parameters for Create method

type NVLinkLogicalPartitionDAO

type NVLinkLogicalPartitionDAO interface {
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*NVLinkLogicalPartition, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter NVLinkLogicalPartitionFilterInput, page paginator.PageInput, includeRelations []string) ([]NVLinkLogicalPartition, int, error)
	//
	Create(ctx context.Context, tx *db.Tx, input NVLinkLogicalPartitionCreateInput) (*NVLinkLogicalPartition, error)
	//
	Update(ctx context.Context, tx *db.Tx, input NVLinkLogicalPartitionUpdateInput) (*NVLinkLogicalPartition, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input NVLinkLogicalPartitionClearInput) (*NVLinkLogicalPartition, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

NVLinkLogicalPartitionDAO is an interface for interacting with the NVLinkLogicalPartition model

func NewNVLinkLogicalPartitionDAO

func NewNVLinkLogicalPartitionDAO(dbSession *db.Session) NVLinkLogicalPartitionDAO

NewNVLinkLogicalPartitionDAO returns a new NVLinkLogicalPartitionDAO

type NVLinkLogicalPartitionFilterInput

type NVLinkLogicalPartitionFilterInput struct {
	NVLinkLogicalPartitionIDs []uuid.UUID
	Names                     []string
	SiteIDs                   []uuid.UUID
	TenantOrgs                []string
	TenantIDs                 []uuid.UUID
	Statuses                  []string
	SearchQuery               *string
}

NVLinkLogicalPartitionFilterInput input parameters for Filter method

type NVLinkLogicalPartitionSQLDAO

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

NVLinkLogicalPartitionSQLDAO is an implementation of the NVLinkLogicalPartitionDAO interface

func (NVLinkLogicalPartitionSQLDAO) Clear

Clear clears NVLinkLogicalPartition attributes based on provided arguments

func (NVLinkLogicalPartitionSQLDAO) Create

Create creates a new NVLinkLogicalPartition from the given parameters

func (NVLinkLogicalPartitionSQLDAO) Delete

func (nvllpsd NVLinkLogicalPartitionSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes a NVLinkLogicalPartition by ID

func (NVLinkLogicalPartitionSQLDAO) GetAll

GetAll returns all NVLinkLogicalPartitions for a tenant or site Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in NVLinkLogicalPartitionOrderByDefault in ascending order

func (NVLinkLogicalPartitionSQLDAO) GetByID

func (nvllpsd NVLinkLogicalPartitionSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*NVLinkLogicalPartition, error)

GetByID returns a NVLinkLogicalPartition by ID

func (NVLinkLogicalPartitionSQLDAO) Update

Update updates an existing NVLinkLogicalPartition from the given parameters

type NVLinkLogicalPartitionUpdateInput

type NVLinkLogicalPartitionUpdateInput struct {
	NVLinkLogicalPartitionID uuid.UUID
	Name                     *string
	Description              *string
	Status                   *string
	IsMissingOnSite          *bool
}

NVLinkLogicalPartitionUpdateInput input parameters for Update method

type NetworkSecurityGroup

type NetworkSecurityGroup struct {
	bun.BaseModel `bun:"table:network_security_group,alias:nsg"`

	ID             string                      `bun:"id,pk"`
	Name           string                      `bun:"name,notnull"`
	Description    *string                     `bun:"description"`
	SiteID         uuid.UUID                   `bun:"site_id,type:uuid,notnull"`
	Site           *Site                       `bun:"rel:belongs-to,join:site_id=id"`
	TenantOrg      string                      `bun:"tenant_org,notnull"`
	TenantID       uuid.UUID                   `bun:"tenant_id,type:uuid,notnull"`
	Tenant         *Tenant                     `bun:"rel:belongs-to,join:tenant_id=id"`
	Status         string                      `bun:"status,notnull"`
	Created        time.Time                   `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated        time.Time                   `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted        *time.Time                  `bun:"deleted,soft_delete"`
	CreatedBy      uuid.UUID                   `bun:"type:uuid,notnull"`
	UpdatedBy      uuid.UUID                   `bun:"type:uuid,notnull"`
	Version        string                      `bun:"version"`
	Labels         map[string]string           `bun:"labels,type:jsonb"`
	StatefulEgress bool                        `bun:"stateful_egress,notnull"`
	Rules          []*NetworkSecurityGroupRule `bun:"rules,type:jsonb"`
}

NetworkSecurityGroup is used to create a firewall for instances

func TestBuildNetworkSecurityGroup

func TestBuildNetworkSecurityGroup(t *testing.T, dbSession *db.Session, name string, tn *Tenant, st *Site) *NetworkSecurityGroup

TestBuildNetworkSecurityGroup creates a test NSG

func (*NetworkSecurityGroup) BeforeAppendModel

func (nsg *NetworkSecurityGroup) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*NetworkSecurityGroup) BeforeCreateTable

func (it *NetworkSecurityGroup) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

func (*NetworkSecurityGroup) GetRulesAsProtoRefs

type NetworkSecurityGroupClearInput

type NetworkSecurityGroupClearInput struct {
	NetworkSecurityGroupID string
	Description            bool
	Labels                 bool
	Rules                  bool
	UpdatedByID            uuid.UUID
}

NetworkSecurityGroupClearInput input parameters for Clear method

type NetworkSecurityGroupCreateInput

type NetworkSecurityGroupCreateInput struct {
	NetworkSecurityGroupID *string
	Name                   string
	Description            *string
	SiteID                 uuid.UUID
	TenantID               uuid.UUID
	TenantOrg              string
	Version                *string
	StatefulEgress         bool
	Rules                  []*NetworkSecurityGroupRule
	Labels                 map[string]string
	Status                 string
	CreatedByID            uuid.UUID
}

NetworkSecurityGroupCreateInput input parameters for Create method

type NetworkSecurityGroupDAO

type NetworkSecurityGroupDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input NetworkSecurityGroupCreateInput) (*NetworkSecurityGroup, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id string, includeRelations []string) (*NetworkSecurityGroup, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter NetworkSecurityGroupFilterInput, page paginator.PageInput, includeRelations []string) ([]NetworkSecurityGroup, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input NetworkSecurityGroupUpdateInput) (*NetworkSecurityGroup, error)
	//
	Delete(ctx context.Context, tx *db.Tx, input NetworkSecurityGroupDeleteInput) error
}

NetworkSecurityGroupDAO is an interface for interacting with the NetworkSecurityGroup model

func NewNetworkSecurityGroupDAO

func NewNetworkSecurityGroupDAO(dbSession *db.Session) NetworkSecurityGroupDAO

NewNetworkSecurityGroupDAO returns a new NetworkSecurityGroupDAO

type NetworkSecurityGroupDeleteInput

type NetworkSecurityGroupDeleteInput struct {
	NetworkSecurityGroupID string
	UpdatedByID            uuid.UUID
}

NetworkSecurityGroupDeleteInput input parameters for Delete method

type NetworkSecurityGroupFilterInput

type NetworkSecurityGroupFilterInput struct {
	Name                    *string
	NetworkSecurityGroupIDs []string
	TenantOrgs              []string
	TenantIDs               []uuid.UUID
	SiteIDs                 []uuid.UUID
	Statuses                []string
	SearchQuery             *string
}

NetworkSecurityGroupFilterInput input parameters for Filter method

type NetworkSecurityGroupPropagationDetails

type NetworkSecurityGroupPropagationDetails struct {
	FriendlyStatus string `json:"friendlyStatus"`
	*cwssaws.NetworkSecurityGroupPropagationObjectStatus
}

A light wrapper around the protobuf so that we can implement our own marshal/unmarshal that understands how to work with protobuf messages

func (*NetworkSecurityGroupPropagationDetails) MarshalJSON

func (s *NetworkSecurityGroupPropagationDetails) MarshalJSON() ([]byte, error)

func (*NetworkSecurityGroupPropagationDetails) UnmarshalJSON

func (s *NetworkSecurityGroupPropagationDetails) UnmarshalJSON(b []byte) error

type NetworkSecurityGroupRule

type NetworkSecurityGroupRule struct {
	*cwssaws.NetworkSecurityGroupRuleAttributes
}

A light wrapper around the protobuf so that we can implement our own marshal/unmarshal that understands how to work with protobuf messages

func (*NetworkSecurityGroupRule) MarshalJSON

func (s *NetworkSecurityGroupRule) MarshalJSON() ([]byte, error)

func (*NetworkSecurityGroupRule) UnmarshalJSON

func (s *NetworkSecurityGroupRule) UnmarshalJSON(b []byte) error

type NetworkSecurityGroupSQLDAO

type NetworkSecurityGroupSQLDAO struct {
	NetworkSecurityGroupDAO
	// contains filtered or unexported fields
}

NetworkSecurityGroupSQLDAO is an implementation of the NetworkSecurityGroupDAO interface

func (NetworkSecurityGroupSQLDAO) Create

Create creates a new NetworkSecurityGroup from the given parameters The returned NetworkSecurityGroup will not have any related structs (InfrastructureProvider/Site) filled in since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (NetworkSecurityGroupSQLDAO) Delete

Delete deletes an NetworkSecurityGroup If the object being deleted doesnt exist, error is not returned (idempotent delete)

func (NetworkSecurityGroupSQLDAO) GetAll

GetAll returns all NetworkSecurityGroups with various optional filters If no records found, then error is nil, but length of returned slice is 0 If orderBy is nil, then records are ordered by column specified in NetworkSecurityGroupOrderByDefault in ascending order

func (NetworkSecurityGroupSQLDAO) GetByID

func (sgsd NetworkSecurityGroupSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id string, includeRelations []string) (*NetworkSecurityGroup, error)

GetByID returns a NetworkSecurityGroup by ID Returns db.ErrDoesNotExist error if the record is not found

func (NetworkSecurityGroupSQLDAO) Update

Update updates specified fields of an existing NetworkSecurityGroup The updated fields are assumed to be set to non-null values For setting to null values, use: Clear Since there are 2 operations (UPDATE, SELECT), it is required that this library call happens within a transaction.

type NetworkSecurityGroupUpdateInput

type NetworkSecurityGroupUpdateInput struct {
	NetworkSecurityGroupID string
	Name                   *string
	Description            *string
	Version                *string
	StatefulEgress         *bool
	Rules                  []*NetworkSecurityGroupRule
	Labels                 map[string]string
	Status                 *string
	UpdatedByID            uuid.UUID
}

NetworkSecurityGroupUpdateInput input parameters for Update method

type OperatingSystem

type OperatingSystem struct {
	bun.BaseModel `bun:"table:operating_system,alias:os"`

	ID                          uuid.UUID               `bun:"type:uuid,pk"`
	Name                        string                  `bun:"name,notnull"`
	Description                 *string                 `bun:"description"`
	Org                         string                  `bun:"org,notnull"`
	InfrastructureProviderID    *uuid.UUID              `bun:"infrastructure_provider_id,type:uuid"`
	InfrastructureProvider      *InfrastructureProvider `bun:"rel:belongs-to,join:infrastructure_provider_id=id"`
	TenantID                    *uuid.UUID              `bun:"tenant_id,type:uuid"`
	Tenant                      *Tenant                 `bun:"rel:belongs-to,join:tenant_id=id"`
	ControllerOperatingSystemID *uuid.UUID              `bun:"controller_operating_system_id,type:uuid"`
	Version                     *string                 `bun:"version"`
	Type                        string                  `bun:"type,notnull"`
	ImageURL                    *string                 `bun:"image_url"`
	ImageSHA                    *string                 `bun:"image_sha"`
	ImageAuthType               *string                 `bun:"image_auth_type"`
	ImageAuthToken              *string                 `bun:"image_auth_token"`
	ImageDisk                   *string                 `bun:"image_disk"`
	RootFsID                    *string                 `bun:"root_fs_id"`
	RootFsLabel                 *string                 `bun:"root_fs_label"`
	IpxeScript                  *string                 `bun:"ipxe_script"`
	UserData                    *string                 `bun:"user_data"`
	IsCloudInit                 bool                    `bun:"is_cloud_init,notnull"`
	AllowOverride               bool                    `bun:"allow_override,notnull"`
	EnableBlockStorage          bool                    `bun:"enable_block_storage,notnull"`
	PhoneHomeEnabled            bool                    `bun:"phone_home_enabled,notnull"`
	IsActive                    bool                    `bun:"is_active,notnull"`
	DeactivationNote            *string                 `bun:"deactivation_note"` // Note for deactivation, if any
	Status                      string                  `bun:"status,notnull"`
	Created                     time.Time               `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                     time.Time               `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                     *time.Time              `bun:"deleted,soft_delete"`
	CreatedBy                   uuid.UUID               `bun:"type:uuid,notnull"`
}

OperatingSystem describes the attributes of the operating system that can be used on instances

func TestBuildOperatingSystem

func TestBuildOperatingSystem(t *testing.T, dbSession *db.Session, name string, tn *Tenant, status string, user *User) *OperatingSystem

TestBuildOperatingSystem creates a test os

func (*OperatingSystem) BeforeAppendModel

func (os *OperatingSystem) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*OperatingSystem) BeforeCreateTable

func (it *OperatingSystem) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type OperatingSystemClearInput

type OperatingSystemClearInput struct {
	OperatingSystemId           uuid.UUID
	Description                 bool
	InfrastructureProviderID    bool
	TenantID                    bool
	ControllerOperatingSystemID bool
	Version                     bool
	ImageURL                    bool
	ImageSHA                    bool
	ImageAuthType               bool
	ImageAuthToken              bool
	ImageDisk                   bool
	RootFsId                    bool
	RootFsLabel                 bool
	IpxeScript                  bool
	UserData                    bool
	DeactivationNote            bool
}

OperatingSystemClearInput input parameters for Clear method

type OperatingSystemCreateInput

type OperatingSystemCreateInput struct {
	Name                        string
	Description                 *string
	Org                         string
	InfrastructureProviderID    *uuid.UUID
	TenantID                    *uuid.UUID
	ControllerOperatingSystemID *uuid.UUID
	Version                     *string
	OsType                      string
	ImageURL                    *string
	ImageSHA                    *string
	ImageAuthType               *string
	ImageAuthToken              *string
	ImageDisk                   *string
	RootFsId                    *string
	RootFsLabel                 *string
	IpxeScript                  *string
	UserData                    *string
	IsCloudInit                 bool
	AllowOverride               bool
	EnableBlockStorage          bool
	PhoneHomeEnabled            bool
	Status                      string
	CreatedBy                   uuid.UUID
}

OperatingSystemCreateInput input parameters for Create method

type OperatingSystemDAO

type OperatingSystemDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input OperatingSystemCreateInput) (*OperatingSystem, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*OperatingSystem, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter OperatingSystemFilterInput, page paginator.PageInput, includeRelations []string) ([]OperatingSystem, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input OperatingSystemUpdateInput) (*OperatingSystem, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input OperatingSystemClearInput) (*OperatingSystem, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

OperatingSystemDAO is an interface for interacting with the OperatingSystem model

func NewOperatingSystemDAO

func NewOperatingSystemDAO(dbSession *db.Session) OperatingSystemDAO

NewOperatingSystemDAO returns a new OperatingSystemDAO

type OperatingSystemFilterInput

type OperatingSystemFilterInput struct {
	InfrastructureProviderID *uuid.UUID
	TenantIDs                []uuid.UUID
	SiteIDs                  []uuid.UUID
	Names                    []string
	Orgs                     []string
	OsTypes                  []string
	Statuses                 []string
	SearchQuery              *string
	OperatingSystemIds       []uuid.UUID
	IsActive                 *bool
}

type OperatingSystemSQLDAO

type OperatingSystemSQLDAO struct {
	OperatingSystemDAO
	// contains filtered or unexported fields
}

OperatingSystemSQLDAO is an implementation of the OperatingSystemDAO interface

func (OperatingSystemSQLDAO) Clear

Clear sets parameters of an existing OperatingSystem to null values in db parameters when true, the are set to null in db since there are 2 operations (UPDATE, SELECT), it is required that this must be within a transaction

func (OperatingSystemSQLDAO) Create

Create creates a new OperatingSystem from the given parameters The returned OperatingSystem will not have any related structs (InfrastructureProvider/Site) filled in since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (OperatingSystemSQLDAO) Delete

func (ossd OperatingSystemSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes an OperatingSystem by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (OperatingSystemSQLDAO) GetAll

func (ossd OperatingSystemSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter OperatingSystemFilterInput, page paginator.PageInput, includeRelations []string) ([]OperatingSystem, int, error)

GetAll returns all OperatingSystems for an InfrastructureProvider Additional optional filters can be specified on name or on siteID errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in OperatingSystemOrderByDefault in ascending order

func (OperatingSystemSQLDAO) GetByID

func (ossd OperatingSystemSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*OperatingSystem, error)

GetByID returns a OperatingSystem by ID Included relations can be a subset of the following: "InfrastructureProvider", "Tenant" returns db.ErrDoesNotExist error if the record is not found

func (OperatingSystemSQLDAO) Update

Update updates specified fields of an existing OperatingSystem The updated fields are assumed to be set to non-null values For setting to null values, use: Clear since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

type OperatingSystemSiteAssociation

type OperatingSystemSiteAssociation struct {
	bun.BaseModel `bun:"table:operating_system_site_association,alias:ossa"`

	ID                uuid.UUID        `bun:"type:uuid,pk"`
	OperatingSystemID uuid.UUID        `bun:"operating_system_id,type:uuid,notnull"`
	OperatingSystem   *OperatingSystem `bun:"rel:belongs-to,join:operating_system_id=id"`
	SiteID            uuid.UUID        `bun:"site_id,type:uuid,notnull"`
	Site              *Site            `bun:"rel:belongs-to,join:site_id=id"`
	Version           *string          `bun:"version"`
	Status            string           `bun:"status,notnull"`
	IsMissingOnSite   bool             `bun:"is_missing_on_site,notnull"`
	Created           time.Time        `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated           time.Time        `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted           *time.Time       `bun:"deleted,soft_delete"`
	CreatedBy         uuid.UUID        `bun:"created_by,type:uuid,notnull"`
}

OperatingSystemSiteAssociation associates an OperatingSystem with different Sites

func (*OperatingSystemSiteAssociation) BeforeAppendModel

func (ossa *OperatingSystemSiteAssociation) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*OperatingSystemSiteAssociation) BeforeCreateTable

func (ossa *OperatingSystemSiteAssociation) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type OperatingSystemSiteAssociationCreateInput

type OperatingSystemSiteAssociationCreateInput struct {
	OperatingSystemID uuid.UUID
	SiteID            uuid.UUID
	Version           *string
	Status            string
	CreatedBy         uuid.UUID
}

OperatingSystemSiteAssociationCreateInput input parameters for Create method

type OperatingSystemSiteAssociationDAO

type OperatingSystemSiteAssociationDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input OperatingSystemSiteAssociationCreateInput) (*OperatingSystemSiteAssociation, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*OperatingSystemSiteAssociation, error)
	//
	GetByOperatingSystemIDAndSiteID(ctx context.Context, tx *db.Tx, OperatingSystemID uuid.UUID, siteID uuid.UUID, includeRelations []string) (*OperatingSystemSiteAssociation, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter OperatingSystemSiteAssociationFilterInput, page paginator.PageInput, includeRelations []string) ([]OperatingSystemSiteAssociation, int, error)
	//
	GenerateAndUpdateVersion(ctx context.Context, tx *db.Tx, ID uuid.UUID) (*OperatingSystemSiteAssociation, error)
	//
	Update(ctx context.Context, tx *db.Tx, input OperatingSystemSiteAssociationUpdateInput) (*OperatingSystemSiteAssociation, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

OperatingSystemSiteAssociationDAO is an interface for interacting with the OperatingSystemSiteAssociation model

func NewOperatingSystemSiteAssociationDAO

func NewOperatingSystemSiteAssociationDAO(dbSession *db.Session) OperatingSystemSiteAssociationDAO

NewOperatingSystemSiteAssociationDAO returns a new OperatingSystemSiteAssociationDAO

type OperatingSystemSiteAssociationFilterInput

type OperatingSystemSiteAssociationFilterInput struct {
	OperatingSystemIDs []uuid.UUID
	SiteIDs            []uuid.UUID
	Versions           []string
	Statuses           []string
}

type OperatingSystemSiteAssociationSQLDAO

type OperatingSystemSiteAssociationSQLDAO struct {
	OperatingSystemSiteAssociationDAO
	// contains filtered or unexported fields
}

OperatingSystemSiteAssociationSQLDAO is an implementation of the OperatingSystemSiteAssociationDAO interface

func (OperatingSystemSiteAssociationSQLDAO) Create

Create creates a new OperatingSystemSiteAssociation from the given parameters

func (OperatingSystemSiteAssociationSQLDAO) Delete

Delete deletes an OperatingSystemSiteAssociation by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned

func (OperatingSystemSiteAssociationSQLDAO) GenerateAndUpdateVersion

func (ossasd OperatingSystemSiteAssociationSQLDAO) GenerateAndUpdateVersion(ctx context.Context, tx *db.Tx, id uuid.UUID) (*OperatingSystemSiteAssociation, error)

GenerateAndUpdateVersion is a utility function to generate latest version and update the OperatingSystemSiteAssociation

func (OperatingSystemSiteAssociationSQLDAO) GetAll

GetAll returns all OperatingSystemSiteAssociation with various optional filters errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in OperatingSystemSiteAssociationOrderByDefault in ascending order

func (OperatingSystemSiteAssociationSQLDAO) GetByID

func (ossasd OperatingSystemSiteAssociationSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*OperatingSystemSiteAssociation, error)

GetByID returns a OperatingSystemSiteAssociation by ID returns db.ErrDoesNotExist error if the record is not found

func (OperatingSystemSiteAssociationSQLDAO) GetByOperatingSystemIDAndSiteID

func (ossasd OperatingSystemSiteAssociationSQLDAO) GetByOperatingSystemIDAndSiteID(ctx context.Context, tx *db.Tx, OperatingSystemID uuid.UUID, siteID uuid.UUID, includeRelations []string) (*OperatingSystemSiteAssociation, error)

GetByOperatingSystemIDAndSiteID returns an OperatingSystemSiteAssociation by OperatingSystemID and SiteID returns db.ErrDoesNotExist error if the record is not found

func (OperatingSystemSiteAssociationSQLDAO) Update

Update updates specified fields of an existing OperatingSystemSiteAssociation

type OperatingSystemSiteAssociationUpdateInput

type OperatingSystemSiteAssociationUpdateInput struct {
	OperatingSystemSiteAssociationID uuid.UUID
	OperatingSystemID                *uuid.UUID
	SiteID                           *uuid.UUID
	Version                          *string
	Status                           *string
	IsMissingOnSite                  *bool
}

OperatingSystemSiteAssociationUpdateInput input parameters for Update method

type OperatingSystemUpdateInput

type OperatingSystemUpdateInput struct {
	OperatingSystemId           uuid.UUID
	Name                        *string
	Description                 *string
	Org                         *string
	InfrastructureProviderID    *uuid.UUID
	TenantID                    *uuid.UUID
	ControllerOperatingSystemID *uuid.UUID
	Version                     *string
	OsType                      *string
	ImageURL                    *string
	ImageSHA                    *string
	ImageAuthType               *string
	ImageAuthToken              *string
	ImageDisk                   *string
	RootFsId                    *string
	RootFsLabel                 *string
	IpxeScript                  *string
	UserData                    *string
	IsCloudInit                 *bool
	AllowOverride               *bool
	EnableBlockStorage          *bool
	PhoneHomeEnabled            *bool
	IsActive                    *bool
	DeactivationNote            *string
	Status                      *string
}

OperatingSystemUpdateInput input parameters for Update method

type Org

type Org struct {
	ID          int        `json:"id"`
	Name        string     `json:"name"`
	DisplayName string     `json:"displayName"`
	OrgType     string     `json:"orgType"`
	Roles       []string   `json:"roles"`
	Teams       []Team     `json:"teams"`
	Updated     *time.Time `json:"updated,omitempty"`
}

Org captures details for organizations

func (Org) Equal

func (o Org) Equal(other Org) bool

Equal compares two Org structs, ignoring order in slices

type OrgData

type OrgData map[string]Org

OrgData is a map of org names to Org structs for the user

func (OrgData) Equal

func (od OrgData) Equal(other OrgData) bool

Equal compares two OrgData pointers, ignoring order in slices

func (OrgData) GetOrgByName

func (od OrgData) GetOrgByName(name string) (*Org, error)

GetOrgByName retrieves details for a given org name (case-insensitive)

type SKU

type SKU struct {
	bun.BaseModel `bun:"table:sku,alias:sk"`

	ID                   string         `bun:"id,pk"`
	SiteID               uuid.UUID      `bun:"site_id,type:uuid,notnull"`
	Site                 *Site          `bun:"rel:belongs-to,join:site_id=id"`
	DeviceType           *string        `bun:"device_type"` // NOTE: can be added once available in nico.proto
	Components           *SkuComponents `bun:"components,type:jsonb"`
	AssociatedMachineIds []string       `bun:"associated_machines,type:text[],default:'{}'"`
	Created              time.Time      `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated              time.Time      `bun:"updated,nullzero,notnull,default:current_timestamp"`
}

SKU represents entries in the sku table

func (*SKU) BeforeAppendModel

func (s *SKU) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*SKU) BeforeCreateTable

func (s *SKU) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type SSHKey

type SSHKey struct {
	bun.BaseModel `bun:"table:ssh_key,alias:sk"`

	ID          uuid.UUID  `bun:"type:uuid,pk"`
	Name        string     `bun:"name,notnull"`
	Org         string     `bun:"org,notnull"`
	TenantID    uuid.UUID  `bun:"tenant_id,type:uuid,notnull"`
	Tenant      *Tenant    `bun:"rel:belongs-to,join:tenant_id=id"`
	PublicKey   string     `bun:"public_key,notnull"`
	Fingerprint *string    `bun:"fingerprint"`
	Expires     *time.Time `bun:"expires"`
	Created     time.Time  `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated     time.Time  `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted     *time.Time `bun:"deleted,soft_delete"`
	CreatedBy   uuid.UUID  `bun:"created_by,type:uuid,notnull"`
}

SSHKey is a user ssh key

func (*SSHKey) BeforeAppendModel

func (sk *SSHKey) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*SSHKey) BeforeCreateTable

func (a *SSHKey) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type SSHKeyAssociation

type SSHKeyAssociation struct {
	bun.BaseModel `bun:"table:ssh_key_association,alias:ska"`

	ID            uuid.UUID    `bun:"type:uuid,pk"`
	SSHKeyID      uuid.UUID    `bun:"ssh_key_id,type:uuid,notnull"`
	SSHKey        *SSHKey      `bun:"rel:belongs-to,join:ssh_key_id=id"`
	SSHKeyGroupID uuid.UUID    `bun:"sshkey_group_id,type:uuid,notnull"`
	SSHKeyGroup   *SSHKeyGroup `bun:"rel:belongs-to,join:sshkey_group_id=id"`
	Created       time.Time    `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated       time.Time    `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted       *time.Time   `bun:"deleted,soft_delete"`
	CreatedBy     uuid.UUID    `bun:"created_by,type:uuid,notnull"`
}

SSHKeyAssociation associates a user ssh key with different entities

func (*SSHKeyAssociation) BeforeAppendModel

func (ska *SSHKeyAssociation) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*SSHKeyAssociation) BeforeCreateTable

func (ska *SSHKeyAssociation) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type SSHKeyAssociationDAO

type SSHKeyAssociationDAO interface {
	//
	CreateFromParams(ctx context.Context, tx *db.Tx, sshKeyID uuid.UUID, sshKeyGroupID uuid.UUID, createdBy uuid.UUID) (*SSHKeyAssociation, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*SSHKeyAssociation, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, sshKeyIDs []uuid.UUID, sshKeyGroupIDs []uuid.UUID, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]SSHKeyAssociation, int, error)
	//
	UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, sshKeyID *uuid.UUID, sshKeyGroupID *uuid.UUID) (*SSHKeyAssociation, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

SSHKeyAssociationDAO is an interface for interacting with the SSHKeyAssociation model

func NewSSHKeyAssociationDAO

func NewSSHKeyAssociationDAO(dbSession *db.Session) SSHKeyAssociationDAO

NewSSHKeyAssociationDAO returns a new SSHKeyAssociationDAO

type SSHKeyAssociationSQLDAO

type SSHKeyAssociationSQLDAO struct {
	SSHKeyAssociationDAO
	// contains filtered or unexported fields
}

SSHKeyAssociationSQLDAO is an implementation of the SSHKeyAssociationDAO interface

func (SSHKeyAssociationSQLDAO) CreateFromParams

func (skasd SSHKeyAssociationSQLDAO) CreateFromParams(
	ctx context.Context, tx *db.Tx,
	sshKeyID uuid.UUID,
	sshKeyGroupID uuid.UUID,
	createdBy uuid.UUID,
) (*SSHKeyAssociation, error)

CreateFromParams creates a new SSHKeyAssociation from the given parameters

func (SSHKeyAssociationSQLDAO) DeleteByID

func (skasd SSHKeyAssociationSQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error

DeleteByID deletes an SSHKeyAssociation by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned

func (SSHKeyAssociationSQLDAO) GetAll

func (skasd SSHKeyAssociationSQLDAO) GetAll(ctx context.Context, tx *db.Tx, sshKeyIDs []uuid.UUID, sshKeyGroupIDs []uuid.UUID, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]SSHKeyAssociation, int, error)

GetAll returns all SSHKeyAssociations with various optional filters errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in SSHKeyAssociationOrderByDefault in ascending order

func (SSHKeyAssociationSQLDAO) GetByID

func (skasd SSHKeyAssociationSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*SSHKeyAssociation, error)

GetByID returns a SSHKeyAssociation by ID returns db.ErrDoesNotExist error if the record is not found

func (SSHKeyAssociationSQLDAO) UpdateFromParams

func (skasd SSHKeyAssociationSQLDAO) UpdateFromParams(
	ctx context.Context, tx *db.Tx,
	id uuid.UUID,
	sshKeyID *uuid.UUID,
	sshKeyGroupID *uuid.UUID,
) (*SSHKeyAssociation, error)

UpdateFromParams updates specified fields of an existing SSHKeyAssociation

type SSHKeyCreateInput

type SSHKeyCreateInput struct {
	SSHKeyID    *uuid.UUID
	Name        string
	TenantOrg   string
	TenantID    uuid.UUID
	PublicKey   string
	Fingerprint *string
	Expires     *time.Time
	CreatedBy   uuid.UUID
}

SSHKeyCreateInput input parameters for Create method

type SSHKeyDAO

type SSHKeyDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input SSHKeyCreateInput) (*SSHKey, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*SSHKey, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter SSHKeyFilterInput, page paginator.PageInput, includeRelations []string) ([]SSHKey, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input SSHKeyUpdateInput) (*SSHKey, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

SSHKeyDAO is an interface for interacting with the SSHKey model

func NewSSHKeyDAO

func NewSSHKeyDAO(dbSession *db.Session) SSHKeyDAO

NewSSHKeyDAO returns a new SSHKeyDAO

type SSHKeyFilterInput

type SSHKeyFilterInput struct {
	SSHKeyIDs      []uuid.UUID
	SSHKeyGroupIDs []uuid.UUID
	Names          []string
	TenantOrgs     []string
	TenantIDs      []uuid.UUID
	Fingerprints   []string
	Expires        *time.Time
	SearchQuery    *string
}

SSHKeyFilterInput input parameters for Filter method

type SSHKeyGroup

type SSHKeyGroup struct {
	bun.BaseModel `bun:"table:sshkey_group,alias:skg"`

	ID          uuid.UUID  `bun:"type:uuid,pk"`
	Name        string     `bun:"name,notnull"`
	Description *string    `bun:"description"`
	Org         string     `bun:"org,notnull"`
	TenantID    uuid.UUID  `bun:"tenant_id,type:uuid,notnull"`
	Tenant      *Tenant    `bun:"rel:belongs-to,join:tenant_id=id"`
	Version     *string    `bun:"version"`
	Status      string     `bun:"status,notnull"`
	Created     time.Time  `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated     time.Time  `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted     *time.Time `bun:"deleted,soft_delete"`
	CreatedBy   uuid.UUID  `bun:"created_by,type:uuid,notnull"`
}

SSHKeyGroup represents a collection of SSH Keys

func (*SSHKeyGroup) BeforeAppendModel

func (skg *SSHKeyGroup) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*SSHKeyGroup) BeforeCreateTable

func (a *SSHKeyGroup) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type SSHKeyGroupCreateInput

type SSHKeyGroupCreateInput struct {
	SSHKeyGroupID *uuid.UUID
	Name          string
	Description   *string
	TenantOrg     string
	TenantID      uuid.UUID
	Version       *string
	Status        string
	CreatedBy     uuid.UUID
}

SSHKeyGroupCreateInput input parameters for Create method

type SSHKeyGroupDAO

type SSHKeyGroupDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input SSHKeyGroupCreateInput) (*SSHKeyGroup, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*SSHKeyGroup, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter SSHKeyGroupFilterInput, page paginator.PageInput, includeRelations []string) ([]SSHKeyGroup, int, error)
	//
	GenerateAndUpdateVersion(ctx context.Context, tx *db.Tx, id uuid.UUID) (*SSHKeyGroup, error)
	//
	Update(ctx context.Context, tx *db.Tx, input SSHKeyGroupUpdateInput) (*SSHKeyGroup, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

SSHKeyGroupDAO is an interface for interacting with the SSHKeyGroup model

func NewSSHKeyGroupDAO

func NewSSHKeyGroupDAO(dbSession *db.Session) SSHKeyGroupDAO

NewSSHKeyGroupDAO returns a new SSHKeyGroupDAO

type SSHKeyGroupFilterInput

type SSHKeyGroupFilterInput struct {
	SSHKeyGroupIDs []uuid.UUID
	Names          []string
	TenantOrgs     []string
	TenantIDs      []uuid.UUID
	Versions       []string
	Statuses       []string
	SearchQuery    *string
}

SSHKeyGroupilterInput input parameters for Filter method

type SSHKeyGroupInstanceAssociation

type SSHKeyGroupInstanceAssociation struct {
	bun.BaseModel `bun:"table:ssh_key_group_instance_association,alias:skgia"`

	ID            uuid.UUID    `bun:"type:uuid,pk"`
	SSHKeyGroupID uuid.UUID    `bun:"ssh_key_group_id,type:uuid,notnull"`
	SSHKeyGroup   *SSHKeyGroup `bun:"rel:belongs-to,join:ssh_key_group_id=id"`
	SiteID        uuid.UUID    `bun:"site_id,type:uuid,notnull"`
	Site          *Site        `bun:"rel:belongs-to,join:site_id=id"`
	InstanceID    uuid.UUID    `bun:"instance_id,type:uuid,notnull"`
	Instance      *Instance    `bun:"rel:belongs-to,join:instance_id=id"`
	Created       time.Time    `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated       time.Time    `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted       *time.Time   `bun:"deleted,soft_delete"`
	CreatedBy     uuid.UUID    `bun:"created_by,type:uuid,notnull"`
}

SSHKeyGroupInstanceAssociation associates a user sshkey group with different entities

func (*SSHKeyGroupInstanceAssociation) BeforeAppendModel

func (skgia *SSHKeyGroupInstanceAssociation) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*SSHKeyGroupInstanceAssociation) BeforeCreateTable

func (skgia *SSHKeyGroupInstanceAssociation) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type SSHKeyGroupInstanceAssociationCreateInput

type SSHKeyGroupInstanceAssociationCreateInput struct {
	SSHKeyGroupID uuid.UUID
	SiteID        uuid.UUID
	InstanceID    uuid.UUID
	CreatedBy     uuid.UUID
}

SSHKeyGroupInstanceAssociationCreateInput input parameters for batch create

type SSHKeyGroupInstanceAssociationDAO

type SSHKeyGroupInstanceAssociationDAO interface {
	//
	CreateFromParams(ctx context.Context, tx *db.Tx, sshKeyGroupID uuid.UUID, siteID uuid.UUID, instanceID uuid.UUID, createdBy uuid.UUID) (*SSHKeyGroupInstanceAssociation, error)
	//
	CreateMultiple(ctx context.Context, tx *db.Tx, inputs []SSHKeyGroupInstanceAssociationCreateInput) ([]SSHKeyGroupInstanceAssociation, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*SSHKeyGroupInstanceAssociation, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, sshKeyGroupIDs []uuid.UUID, siteIDs []uuid.UUID, instanceIDs []uuid.UUID, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]SSHKeyGroupInstanceAssociation, int, error)
	//
	UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, sshKeyGroupID *uuid.UUID, siteID *uuid.UUID, instanceID *uuid.UUID) (*SSHKeyGroupInstanceAssociation, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

SSHKeyGroupInstanceAssociationDAO is an interface for interacting with the SSHKeyGroupInstanceAssociation model

func NewSSHKeyGroupInstanceAssociationDAO

func NewSSHKeyGroupInstanceAssociationDAO(dbSession *db.Session) SSHKeyGroupInstanceAssociationDAO

NewSSHKeyGroupInstanceAssociationDAO returns a new SSHKeyGroupInstanceAssociationDAO

type SSHKeyGroupInstanceAssociationSQLDAO

type SSHKeyGroupInstanceAssociationSQLDAO struct {
	SSHKeyGroupInstanceAssociationDAO
	// contains filtered or unexported fields
}

SSHKeyGroupInstanceAssociationSQLDAO is an implementation of the SSHKeyGroupInstanceAssociationDAO interface

func (SSHKeyGroupInstanceAssociationSQLDAO) CreateFromParams

func (skgiasd SSHKeyGroupInstanceAssociationSQLDAO) CreateFromParams(ctx context.Context, tx *db.Tx, sshKeyGroupID uuid.UUID, siteID uuid.UUID, instanceID uuid.UUID, createdBy uuid.UUID) (*SSHKeyGroupInstanceAssociation, error)

CreateFromParams creates a new SSHKeyGroupInstanceAssociation from the given parameters

func (SSHKeyGroupInstanceAssociationSQLDAO) CreateMultiple

CreateMultiple creates multiple SSHKeyGroupInstanceAssociations from the given parameters

func (SSHKeyGroupInstanceAssociationSQLDAO) DeleteByID

func (skgiasd SSHKeyGroupInstanceAssociationSQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error

DeleteByID deletes an SSHKeyGroupInstanceAssociation by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned

func (SSHKeyGroupInstanceAssociationSQLDAO) GetAll

func (skgiasd SSHKeyGroupInstanceAssociationSQLDAO) GetAll(ctx context.Context, tx *db.Tx, sshKeyGroupIDs []uuid.UUID, siteIDs []uuid.UUID, instanceIDs []uuid.UUID, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]SSHKeyGroupInstanceAssociation, int, error)

GetAll returns all SSHKeyGroupInstanceAssociation with various optional filters errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in SSHKeyGroupInstanceAssociationOrderByDefault in ascending order

func (SSHKeyGroupInstanceAssociationSQLDAO) GetByID

func (skgiasd SSHKeyGroupInstanceAssociationSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*SSHKeyGroupInstanceAssociation, error)

GetByID returns a SSHKeyGroupInstanceAssociation by ID returns db.ErrDoesNotExist error if the record is not found

func (SSHKeyGroupInstanceAssociationSQLDAO) UpdateFromParams

func (skgiasd SSHKeyGroupInstanceAssociationSQLDAO) UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, sshKeyGroupID *uuid.UUID, siteID *uuid.UUID, instanceID *uuid.UUID) (*SSHKeyGroupInstanceAssociation, error)

UpdateFromParams updates specified fields of an existing SSHKeyGroupInstanceAssociation

type SSHKeyGroupSQLDAO

type SSHKeyGroupSQLDAO struct {
	SSHKeyGroupDAO
	// contains filtered or unexported fields
}

SSHKeyGroupSQLDAO is an implementation of the SSHKeyGroupDAO interface

func (SSHKeyGroupSQLDAO) Create

func (skgsd SSHKeyGroupSQLDAO) Create(ctx context.Context, tx *db.Tx, input SSHKeyGroupCreateInput) (*SSHKeyGroup, error)

Create creates a new SSHKeyGroup from the given parameters

func (SSHKeyGroupSQLDAO) Delete

func (skgsd SSHKeyGroupSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes an SSHKeyGroup by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned

func (SSHKeyGroupSQLDAO) GenerateAndUpdateVersion

func (skgsd SSHKeyGroupSQLDAO) GenerateAndUpdateVersion(ctx context.Context, tx *db.Tx, id uuid.UUID) (*SSHKeyGroup, error)

GenerateAndUpdateVersion generates version based on current content and updates the version field

func (SSHKeyGroupSQLDAO) GetAll

func (skgsd SSHKeyGroupSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter SSHKeyGroupFilterInput, page paginator.PageInput, includeRelations []string) ([]SSHKeyGroup, int, error)

GetAll returns all SSHKeyGroups with various optional filters errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in SSHKeyGroupOrderByDefault in ascending order

func (SSHKeyGroupSQLDAO) GetByID

func (skgsd SSHKeyGroupSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*SSHKeyGroup, error)

GetByID returns a SSHKeyGroup by ID returns db.ErrDoesNotExist error if the record is not found

func (SSHKeyGroupSQLDAO) Update

func (skgsd SSHKeyGroupSQLDAO) Update(ctx context.Context, tx *db.Tx, input SSHKeyGroupUpdateInput) (*SSHKeyGroup, error)

Update updates specified fields of an existing SSHKeyGroup The updated fields are assumed to be set to non-null values

type SSHKeyGroupSiteAssociation

type SSHKeyGroupSiteAssociation struct {
	bun.BaseModel `bun:"table:ssh_key_group_site_association,alias:skgsa"`

	ID              uuid.UUID    `bun:"type:uuid,pk"`
	SSHKeyGroupID   uuid.UUID    `bun:"sshkey_group_id,type:uuid,notnull"`
	SSHKeyGroup     *SSHKeyGroup `bun:"rel:belongs-to,join:sshkey_group_id=id"`
	SiteID          uuid.UUID    `bun:"site_id,type:uuid,notnull"`
	Site            *Site        `bun:"rel:belongs-to,join:site_id=id"`
	Version         *string      `bun:"version"`
	Status          string       `bun:"status,notnull"`
	IsMissingOnSite bool         `bun:"is_missing_on_site,notnull"`
	Created         time.Time    `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated         time.Time    `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted         *time.Time   `bun:"deleted,soft_delete"`
	CreatedBy       uuid.UUID    `bun:"created_by,type:uuid,notnull"`
}

SSHKeyGroupSiteAssociation associates a user sshkey group with different Sites

func (*SSHKeyGroupSiteAssociation) BeforeAppendModel

func (skgsa *SSHKeyGroupSiteAssociation) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*SSHKeyGroupSiteAssociation) BeforeCreateTable

func (skgsa *SSHKeyGroupSiteAssociation) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type SSHKeyGroupSiteAssociationDAO

type SSHKeyGroupSiteAssociationDAO interface {
	//
	CreateFromParams(ctx context.Context, tx *db.Tx, sshKeyGroupID uuid.UUID, siteID uuid.UUID, version *string, status string, createdBy uuid.UUID) (*SSHKeyGroupSiteAssociation, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*SSHKeyGroupSiteAssociation, error)
	//
	GetBySSHKeyGroupIDAndSiteID(ctx context.Context, tx *db.Tx, sshKeyGroupID uuid.UUID, siteID uuid.UUID, includeRelations []string) (*SSHKeyGroupSiteAssociation, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, sshKeyGroupIDs []uuid.UUID, siteID *uuid.UUID, version *string, status *string, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]SSHKeyGroupSiteAssociation, int, error)
	//
	GenerateAndUpdateVersion(ctx context.Context, tx *db.Tx, ID uuid.UUID) (*SSHKeyGroupSiteAssociation, error)
	//
	UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, sshKeyGroupID *uuid.UUID, siteID *uuid.UUID, version *string, status *string, isMissingOnSite *bool) (*SSHKeyGroupSiteAssociation, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

SSHKeyGroupSiteAssociationDAO is an interface for interacting with the SSHKeyGroupSiteAssociation model

func NewSSHKeyGroupSiteAssociationDAO

func NewSSHKeyGroupSiteAssociationDAO(dbSession *db.Session) SSHKeyGroupSiteAssociationDAO

NewSSHKeyGroupSiteAssociationDAO returns a new SSHKeyGroupSiteAssociationDAO

type SSHKeyGroupSiteAssociationSQLDAO

type SSHKeyGroupSiteAssociationSQLDAO struct {
	SSHKeyGroupSiteAssociationDAO
	// contains filtered or unexported fields
}

SSHKeyGroupSiteAssociationSQLDAO is an implementation of the SSHKeyGroupSiteAssociationDAO interface

func (SSHKeyGroupSiteAssociationSQLDAO) CreateFromParams

func (skgsasd SSHKeyGroupSiteAssociationSQLDAO) CreateFromParams(
	ctx context.Context, tx *db.Tx,
	sshKeyGroupID uuid.UUID,
	siteID uuid.UUID,
	version *string,
	status string,
	createdBy uuid.UUID,
) (*SSHKeyGroupSiteAssociation, error)

CreateFromParams creates a new SSHKeyGroupSiteAssociation from the given parameters

func (SSHKeyGroupSiteAssociationSQLDAO) DeleteByID

func (skgsasd SSHKeyGroupSiteAssociationSQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error

DeleteByID deletes an SSHKeyGroupSiteAssociation by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned

func (SSHKeyGroupSiteAssociationSQLDAO) GenerateAndUpdateVersion

func (skgsasd SSHKeyGroupSiteAssociationSQLDAO) GenerateAndUpdateVersion(ctx context.Context, tx *db.Tx, id uuid.UUID) (*SSHKeyGroupSiteAssociation, error)

GenerateAndUpdateVersion is a utility function to generate latest version and update the SSHKeyGroupSiteAssociation

func (SSHKeyGroupSiteAssociationSQLDAO) GetAll

func (skgsasd SSHKeyGroupSiteAssociationSQLDAO) GetAll(ctx context.Context, tx *db.Tx, sshKeyGroupIDs []uuid.UUID, siteID *uuid.UUID, version *string, status *string, includeRelations []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]SSHKeyGroupSiteAssociation, int, error)

GetAll returns all SSHKeyGroupSiteAssociation with various optional filters errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in SSHKeyGroupSiteAssociationOrderByDefault in ascending order

func (SSHKeyGroupSiteAssociationSQLDAO) GetByID

func (skgsasd SSHKeyGroupSiteAssociationSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*SSHKeyGroupSiteAssociation, error)

GetByID returns a SSHKeyGroupSiteAssociation by ID returns db.ErrDoesNotExist error if the record is not found

func (SSHKeyGroupSiteAssociationSQLDAO) GetBySSHKeyGroupIDAndSiteID

func (skgsasd SSHKeyGroupSiteAssociationSQLDAO) GetBySSHKeyGroupIDAndSiteID(ctx context.Context, tx *db.Tx, sshKeyGroupID uuid.UUID, siteID uuid.UUID, includeRelations []string) (*SSHKeyGroupSiteAssociation, error)

GetBySSHKeyGroupIDAndSiteID returns a SSHKeyGroupSiteAssociation by SSHKeyGroupID and SiteID returns db.ErrDoesNotExist error if the record is not found

func (SSHKeyGroupSiteAssociationSQLDAO) UpdateFromParams

func (skgsasd SSHKeyGroupSiteAssociationSQLDAO) UpdateFromParams(
	ctx context.Context, tx *db.Tx,
	id uuid.UUID,
	sshKeyGroupID *uuid.UUID,
	siteID *uuid.UUID,
	version *string,
	status *string,
	isMissingOnSite *bool,
) (*SSHKeyGroupSiteAssociation, error)

UpdateFromParams updates specified fields of an existing SSHKeyGroupSiteAssociation

type SSHKeyGroupUpdateInput

type SSHKeyGroupUpdateInput struct {
	SSHKeyGroupID uuid.UUID
	Name          *string
	Description   *string
	TenantOrg     *string
	TenantID      *uuid.UUID
	Version       *string
	Status        *string
}

SSHKeyGroupUpdateInput input parameters for Update method

type SSHKeySQLDAO

type SSHKeySQLDAO struct {
	SSHKeyDAO
	// contains filtered or unexported fields
}

SSHKeySQLDAO is an implementation of the SSHKeyDAO interface

func (SSHKeySQLDAO) Create

func (sksd SSHKeySQLDAO) Create(ctx context.Context, tx *db.Tx, input SSHKeyCreateInput) (*SSHKey, error)

CreateFromParams creates a new SSHKey from the given parameters

func (SSHKeySQLDAO) Delete

func (sksd SSHKeySQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes an SSHKey by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned

func (SSHKeySQLDAO) GetAll

func (sksd SSHKeySQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter SSHKeyFilterInput, page paginator.PageInput, includeRelations []string) ([]SSHKey, int, error)

GetAll returns all SSHKeys with various optional filters errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in SSHKeyOrderByDefault in ascending order

func (SSHKeySQLDAO) GetByID

func (sksd SSHKeySQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*SSHKey, error)

GetByID returns a SSHKey by ID returns db.ErrDoesNotExist error if the record is not found

func (SSHKeySQLDAO) Update

func (sksd SSHKeySQLDAO) Update(ctx context.Context, tx *db.Tx, input SSHKeyUpdateInput) (*SSHKey, error)

UpdateFromParams updates specified fields of an existing SSHKey The updated fields are assumed to be set to non-null values

type SSHKeyUpdateInput

type SSHKeyUpdateInput struct {
	SSHKeyID    uuid.UUID
	Name        *string
	TenantOrg   *string
	TenantID    *uuid.UUID
	PublicKey   *string
	Fingerprint *string
	Expires     *time.Time
}

SSHKeyUpdateInput input parameters for Update method

type Site

type Site struct {
	bun.BaseModel `bun:"table:site,alias:st"`

	ID                            uuid.UUID               `bun:"type:uuid,pk"`
	Name                          string                  `bun:"name,notnull"`
	DisplayName                   *string                 `bun:"display_name"`
	Description                   *string                 `bun:"description"`
	Org                           string                  `bun:"org,notnull"`
	InfrastructureProviderID      uuid.UUID               `bun:"infrastructure_provider_id,type:uuid,notnull"`
	InfrastructureProvider        *InfrastructureProvider `bun:"rel:belongs-to,join:infrastructure_provider_id=id"`
	SiteControllerVersion         *string                 `bun:"site_controller_version"`
	SiteAgentVersion              *string                 `bun:"site_agent_version"`
	RegistrationToken             *string                 `bun:"registration_token"`
	RegistrationTokenExpiration   *time.Time              `bun:"registration_token_expiration"`
	SerialConsoleHostname         *string                 `bun:"serial_console_hostname"`
	IsSerialConsoleEnabled        bool                    `bun:"is_serial_console_enabled,notnull"`
	SerialConsoleIdleTimeout      *int                    `bun:"serial_console_idle_timeout"`
	SerialConsoleMaxSessionLength *int                    `bun:"serial_console_max_session_length"`
	IsInfinityEnabled             bool                    `bun:"is_infinity_enabled,notnull"`
	InventoryReceived             *time.Time              `bun:"inventory_received"`
	Status                        string                  `bun:"status,notnull"`
	Created                       time.Time               `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                       time.Time               `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                       *time.Time              `bun:"deleted,soft_delete"`
	CreatedBy                     uuid.UUID               `bun:"type:uuid,notnull"`
	Location                      *SiteLocation           `bun:"location"` // since this is a json object, type of the column will be JSONB automatically
	Contact                       *SiteContact            `bun:"contact"`  // since this is a json object, type of the column will be JSONB automatically
	AgentCertExpiry               *time.Time              `bun:"agent_cert_expiry"`
	Config                        *SiteConfig             `bun:"config,type:jsonb"`
}

Site represents entries in the site table

func TestBuildSite

func TestBuildSite(t *testing.T, dbSession *db.Session, ip *InfrastructureProvider, name string, user *User) *Site

TestBuildSite creates a test Site

func (*Site) BeforeAppendModel

func (st *Site) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*Site) BeforeCreateTable

func (s *Site) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type SiteConfig

type SiteConfig struct {
	NetworkSecurityGroup             bool `json:"network_security_group"`
	NativeNetworking                 bool `json:"native_networking"`
	NVLinkPartition                  bool `json:"nvlink_partition"`
	Flow                             bool `json:"flow"`
	ImageBasedOperatingSystem        bool `json:"image_based_operating_system"`
	MaxNetworkSecurityGroupRuleCount *int `json:"max_network_security_group_rule_count"`
}

Config should be kept flat to allow simple merging of updates at the postgres/jsonb level. We use jsonb_set + || to allow "partial" updates, but any nesting here would prevent that.

type SiteConfigFilterInput

type SiteConfigFilterInput struct {
	NetworkSecurityGroup             *bool `json:"network_security_group,omitempty"`
	NativeNetworking                 *bool `json:"native_networking,omitempty"`
	NVLinkPartition                  *bool `json:"nvlink_partition,omitempty"`
	Flow                             *bool `json:"flow,omitempty"`
	ImageBasedOperatingSystem        *bool `json:"image_based_operating_system,omitempty"`
	MaxNetworkSecurityGroupRuleCount *int  `json:"max_network_security_group_rule_count,omitempty"`
}

type SiteConfigUpdateInput

type SiteConfigUpdateInput struct {
	NetworkSecurityGroup             *bool `json:"network_security_group,omitempty"`
	NativeNetworking                 *bool `json:"native_networking,omitempty"`
	NVLinkPartition                  *bool `json:"nvlink_partition,omitempty"`
	Flow                             *bool `json:"flow,omitempty"`
	ImageBasedOperatingSystem        *bool `json:"image_based_operating_system,omitempty"`
	MaxNetworkSecurityGroupRuleCount *int  `json:"max_network_security_group_rule_count,omitempty"`
}

type SiteContact

type SiteContact struct {
	Email string `json:"email"`
}

type SiteControllerMachine

type SiteControllerMachine struct {
	*cwssaws.Machine
}

A light wrapper around the protobuf so that we can implement our own marshal/unmarshal that understands how to work with protobuf messages

func (*SiteControllerMachine) GetNormalizedState

func (s *SiteControllerMachine) GetNormalizedState() string

GetNormalizedState returns the normalized state for the embedded controller machine When non-empty, the controller machine state prefix without the JSON state suffix (`{...}`) is returned, otherwise the full state is returned The returned state is empty when nil or the embedded controller machine is missing

func (*SiteControllerMachine) MarshalJSON

func (s *SiteControllerMachine) MarshalJSON() ([]byte, error)

func (*SiteControllerMachine) UnmarshalJSON

func (s *SiteControllerMachine) UnmarshalJSON(b []byte) error

type SiteCreateInput

type SiteCreateInput struct {
	Name                          string
	DisplayName                   *string
	Description                   *string
	Org                           string
	InfrastructureProviderID      uuid.UUID
	SiteControllerVersion         *string
	SiteAgentVersion              *string
	RegistrationToken             *string
	RegistrationTokenExpiration   *time.Time
	SerialConsoleHostname         *string
	IsSerialConsoleEnabled        bool
	SerialConsoleIdleTimeout      *int
	SerialConsoleMaxSessionLength *int
	IsInfinityEnabled             bool
	InventoryReceived             *time.Time
	Status                        string
	CreatedBy                     uuid.UUID
	Location                      *SiteLocation
	Contact                       *SiteContact
	Config                        SiteConfig
}

type SiteDAO

type SiteDAO interface {
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string, includeDeleted bool) (*Site, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter SiteFilterInput, page paginator.PageInput, includeRelations []string) (sites []Site, total int, err error)
	// GetCount returns total count of rows for specified filter
	GetCount(ctx context.Context, tx *db.Tx, filter SiteFilterInput) (count int, err error)
	//
	Create(ctx context.Context, tx *db.Tx, input SiteCreateInput) (*Site, error)
	//
	Update(ctx context.Context, tx *db.Tx, input SiteUpdateInput) (*Site, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

SiteDAO is the data access interface for Site

func NewSiteDAO

func NewSiteDAO(dbSession *db.Session) SiteDAO

NewSiteDAO returns a new SiteDAO

type SiteFilterInput

type SiteFilterInput struct {
	Name                      *string
	Org                       *string
	InfrastructureProviderIDs []uuid.UUID
	SiteIDs                   []uuid.UUID
	Config                    *SiteConfigFilterInput
	Statuses                  []string
	SearchQuery               *string
}

type SiteLocation

type SiteLocation struct {
	City    string `json:"city"`
	State   string `json:"state"`
	Country string `json:"country"`
}

type SiteSQLDAO

type SiteSQLDAO struct {
	SiteDAO
	// contains filtered or unexported fields
}

SiteSQLDAO is the SQL data access object for Site

func (SiteSQLDAO) Create

func (ssd SiteSQLDAO) Create(ctx context.Context, tx *db.Tx, input SiteCreateInput) (*Site, error)

Create creates a Site from the given parameters

func (SiteSQLDAO) Delete

func (ssd SiteSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes a Site by its ID

func (SiteSQLDAO) GetAll

func (ssd SiteSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter SiteFilterInput, page paginator.PageInput, includeRelations []string) (sites []Site, total int, err error)

GetAll returns all Sites for given params if orderBy is nil, then records are ordered by column specified in SiteOrderByDefault in ascending order

func (SiteSQLDAO) GetByID

func (ssd SiteSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string, includeDeleted bool) (*Site, error)

GetByID returns a Site by its ID

func (SiteSQLDAO) GetCount

func (ssd SiteSQLDAO) GetCount(ctx context.Context, tx *db.Tx, filter SiteFilterInput) (count int, err error)

GetCount returns count of sites for given params

func (SiteSQLDAO) Update

func (ssd SiteSQLDAO) Update(ctx context.Context, tx *db.Tx, input SiteUpdateInput) (*Site, error)

Update updates a Site from the given parameters

type SiteUpdateInput

type SiteUpdateInput struct {
	SiteID                        uuid.UUID
	Name                          *string
	DisplayName                   *string
	Description                   *string
	InfrastructureProviderID      uuid.UUID
	SiteControllerVersion         *string
	SiteAgentVersion              *string
	RegistrationToken             *string
	RegistrationTokenExpiration   *time.Time
	SerialConsoleHostname         *string
	IsSerialConsoleEnabled        *bool
	SerialConsoleIdleTimeout      *int
	SerialConsoleMaxSessionLength *int
	IsInfinityEnabled             *bool
	InventoryReceived             *time.Time
	Status                        *string
	Location                      *SiteLocation
	Contact                       *SiteContact
	AgentCertExpiry               *time.Time
	Config                        *SiteConfigUpdateInput
}

type SkuComponents

type SkuComponents struct {
	*cwssaws.SkuComponents
}

SkuComponents is a light wrapper around the protobuf so that we can implement our own marshal/unmarshal that understands how to work with protobuf messages

func (*SkuComponents) MarshalJSON

func (s *SkuComponents) MarshalJSON() ([]byte, error)

func (*SkuComponents) UnmarshalJSON

func (s *SkuComponents) UnmarshalJSON(b []byte) error

type SkuCreateInput

type SkuCreateInput struct {
	SkuID                string // NICo is the source of truth: id must always be provided on creation.
	SiteID               uuid.UUID
	Components           *SkuComponents
	DeviceType           *string
	AssociatedMachineIds []string
}

SkuCreateInput input parameters for Create method

type SkuDAO

type SkuDAO interface {
	// Create used to create new row
	Create(ctx context.Context, tx *db.Tx, input SkuCreateInput) (*SKU, error)
	// Update used to update row
	Update(ctx context.Context, tx *db.Tx, input SkuUpdateInput) (*SKU, error)
	// Delete used to delete row
	Delete(ctx context.Context, tx *db.Tx, skuID string) error
	// GetAll returns all the rows based on the filter and page inputs
	GetAll(ctx context.Context, tx *db.Tx, filter SkuFilterInput, page paginator.PageInput) ([]SKU, int, error)
	// Get returns row for specified ID
	Get(ctx context.Context, tx *db.Tx, skuID string) (*SKU, error)
}

SkuDAO is an interface for interacting with the SKU model

func NewSkuDAO

func NewSkuDAO(dbSession *db.Session) SkuDAO

NewSkuDAO returns a new SkuDAO

type SkuFilterInput

type SkuFilterInput struct {
	SiteIDs              []uuid.UUID
	SkuIDs               []string
	DeviceTypes          []string
	AssociatedMachineIds []string
}

SkuFilterInput input parameters for Filter method

type SkuSQLDAO

type SkuSQLDAO struct {
	SkuDAO
	// contains filtered or unexported fields
}

SkuSQLDAO is an implementation of the SkuDAO interface

func (SkuSQLDAO) Create

func (ssd SkuSQLDAO) Create(ctx context.Context, tx *db.Tx, input SkuCreateInput) (*SKU, error)

Create creates a new SKU from the given parameters SKU comes from NICo, so SkuID is required

func (SkuSQLDAO) Delete

func (ssd SkuSQLDAO) Delete(ctx context.Context, tx *db.Tx, id string) error

Delete deletes a SKU by ID

func (SkuSQLDAO) Get

func (ssd SkuSQLDAO) Get(ctx context.Context, tx *db.Tx, id string) (*SKU, error)

Get returns a SKU by ID returns db.ErrDoesNotExist error if the record is not found

func (SkuSQLDAO) GetAll

func (ssd SkuSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter SkuFilterInput, page paginator.PageInput) ([]SKU, int, error)

GetAll returns all SKUs with optional filters If orderBy is nil, then records are ordered by column specified in SkuOrderByDefault in ascending order

func (SkuSQLDAO) Update

func (ssd SkuSQLDAO) Update(ctx context.Context, tx *db.Tx, input SkuUpdateInput) (*SKU, error)

Update updates specified fields of an existing SKU

type SkuUpdateInput

type SkuUpdateInput struct {
	SkuID                string
	Components           *SkuComponents
	DeviceType           *string
	AssociatedMachineIds []string
}

SkuUpdateInput input parameters for Update method

type StatusDetail

type StatusDetail struct {
	bun.BaseModel `bun:"table:status_detail,alias:sd"`

	ID       uuid.UUID `bun:"type:uuid,pk"`
	EntityID string    `bun:"entity_id"`
	Status   string    `bun:"status,notnull"`
	Message  *string   `bun:"message"`
	Count    int       `bun:"count,notnull"`
	Created  time.Time `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated  time.Time `bun:"updated,nullzero,notnull,default:current_timestamp"`
}

StatusDetail represents entries in the status_detail table

func (*StatusDetail) BeforeAppendModel

func (sd *StatusDetail) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

type StatusDetailCreateInput

type StatusDetailCreateInput struct {
	EntityID string
	Status   string
	Message  *string
}

StatusDetailCreateInput input parameters for batch create

type StatusDetailDAO

type StatusDetailDAO interface {
	//
	GetAllByEntityID(ctx context.Context, tx *db.Tx, entityID string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]StatusDetail, int, error)
	//
	GetAllByEntityIDs(ctx context.Context, tx *db.Tx, entityIDs []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]StatusDetail, int, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID) (*StatusDetail, error)
	//
	CreateFromParams(ctx context.Context, tx *db.Tx, entityID string, status string, message *string) (*StatusDetail, error)
	//
	CreateMultiple(ctx context.Context, tx *db.Tx, inputs []StatusDetailCreateInput) ([]StatusDetail, error)
	//
	UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, status string, message *string) (*StatusDetail, error)
	// GetRecentByEntityIDs returns most recent status records for specified entity IDs
	GetRecentByEntityIDs(ctx context.Context, tx *db.Tx, entityIDs []string, recentCount int) ([]StatusDetail, error)
}

StatusDetailDAO is the data access interface for StatusDetail

func NewStatusDetailDAO

func NewStatusDetailDAO(dbSession *db.Session) StatusDetailDAO

NewStatusDetailDAO creates and returns a new data access object for StatusDetail

type StatusDetailSQLDAO

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

StatusDetailSQLDAO is the data access object for StatusDetail

func (StatusDetailSQLDAO) CreateFromParams

func (sdd StatusDetailSQLDAO) CreateFromParams(ctx context.Context, tx *db.Tx, entityID string, status string, message *string) (*StatusDetail, error)

CreateFromParams creates a new StatusDetail from the given parameters

func (StatusDetailSQLDAO) CreateMultiple

func (sdd StatusDetailSQLDAO) CreateMultiple(ctx context.Context, tx *db.Tx, inputs []StatusDetailCreateInput) ([]StatusDetail, error)

CreateMultiple creates multiple StatusDetails from the given parameters

func (StatusDetailSQLDAO) GetAllByEntityID

func (sdd StatusDetailSQLDAO) GetAllByEntityID(ctx context.Context, tx *db.Tx, entityID string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]StatusDetail, int, error)

GetAllByEntityID returns status details for the given entity ID

func (StatusDetailSQLDAO) GetAllByEntityIDs

func (sdd StatusDetailSQLDAO) GetAllByEntityIDs(ctx context.Context, tx *db.Tx, entityIDs []string, offset *int, limit *int, orderBy *paginator.OrderBy) ([]StatusDetail, int, error)

GetAllByEntityIDs returns status details for the given set of entity IDs

func (StatusDetailSQLDAO) GetByID

func (sdd StatusDetailSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID) (*StatusDetail, error)

GetByID returns a StatusDetail by ID

func (StatusDetailSQLDAO) GetRecentByEntityIDs

func (sdd StatusDetailSQLDAO) GetRecentByEntityIDs(ctx context.Context, tx *db.Tx, entityIDs []string, recentCount int) ([]StatusDetail, error)

GetRecentByEntityIDs returns most recent status records for specified entity IDs

func (StatusDetailSQLDAO) UpdateFromParams

func (sdd StatusDetailSQLDAO) UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, status string, message *string) (*StatusDetail, error)

UpdateFromParams updates the given StatusDetail with the given parameters

type Subnet

type Subnet struct {
	bun.BaseModel `bun:"table:subnet,alias:su"`

	ID                         uuid.UUID  `bun:"type:uuid,pk"`
	Name                       string     `bun:"name,notnull"`
	Description                *string    `bun:"description"`
	Org                        string     `bun:"org,notnull"`
	SiteID                     uuid.UUID  `bun:"site_id,type:uuid,notnull"`
	Site                       *Site      `bun:"rel:belongs-to,join:site_id=id"`
	VpcID                      uuid.UUID  `bun:"vpc_id,type:uuid,notnull"`
	Vpc                        *Vpc       `bun:"rel:belongs-to,join:vpc_id=id"`
	DomainID                   *uuid.UUID `bun:"domain_id,type:uuid"`
	Domain                     *Domain    `bun:"rel:belongs-to,join:domain_id=id"`
	TenantID                   uuid.UUID  `bun:"tenant_id,type:uuid"`
	Tenant                     *Tenant    `bun:"rel:belongs-to,join:tenant_id=id"`
	ControllerNetworkSegmentID *uuid.UUID `bun:"controller_network_segment_id,type:uuid"`
	RoutingType                *string    `bun:"routing_type"`
	IPv4Prefix                 *string    `bun:"ipv4_prefix"`
	IPv4Gateway                *string    `bun:"ipv4_gateway"`
	IPv4BlockID                *uuid.UUID `bun:"ipv4_block_id,type:uuid"`
	IPv4Block                  *IPBlock   `bun:"rel:belongs-to,join:ipv4_block_id=id"`
	IPv6Prefix                 *string    `bun:"ipv6_prefix"`
	IPv6Gateway                *string    `bun:"ipv6_gateway"`
	IPv6BlockID                *uuid.UUID `bun:"ipv6_block_id,type:uuid"`
	IPv6Block                  *IPBlock   `bun:"rel:belongs-to,join:ipv6_block_id=id"`
	PrefixLength               int        `bun:"prefix_length,notnull"`
	MTU                        *int       `bun:"mtu"`
	Status                     string     `bun:"status,notnull"`
	IsMissingOnSite            bool       `bun:"is_missing_on_site,notnull"`
	Created                    time.Time  `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                    time.Time  `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                    *time.Time `bun:"deleted,soft_delete"`
	CreatedBy                  uuid.UUID  `bun:"type:uuid,notnull"`
}

Subnet is a network construct for bare-metal machines

func TestBuildSubnet

func TestBuildSubnet(t *testing.T, dbSession *db.Session, name string, tn *Tenant, vpc *Vpc, controllerID *uuid.UUID, ipv4Block *IPBlock, status string, user *User) *Subnet

TestBuildSubnet creates a test subnet

func (*Subnet) BeforeAppendModel

func (su *Subnet) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*Subnet) BeforeCreateTable

func (it *Subnet) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type SubnetClearInput

type SubnetClearInput struct {
	SubnetId                   uuid.UUID
	Description                bool
	DomainID                   bool
	ControllerNetworkSegmentID bool
	IPv4Prefix                 bool
	IPv4Gateway                bool
	IPv4BlockID                bool
	IPv6Prefix                 bool
	IPv6Gateway                bool
	IPv6BlockID                bool
	Mtu                        bool
}

SubnetClearInput parameters for Clear method

type SubnetCreateInput

type SubnetCreateInput struct {
	Name                       string
	Description                *string
	Org                        string
	SiteID                     uuid.UUID
	VpcID                      uuid.UUID
	DomainID                   *uuid.UUID
	TenantID                   uuid.UUID
	ControllerNetworkSegmentID *uuid.UUID
	RoutingType                *string
	IPv4Prefix                 *string
	IPv4Gateway                *string
	IPv4BlockID                *uuid.UUID
	IPv6Prefix                 *string
	IPv6Gateway                *string
	IPv6BlockID                *uuid.UUID
	PrefixLength               int
	Mtu                        *int
	Status                     string
	CreatedBy                  uuid.UUID
}

SubnetCreateInput parameters for Create method

type SubnetDAO

type SubnetDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input SubnetCreateInput) (*Subnet, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Subnet, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter SubnetFilterInput, page paginator.PageInput, includeRelations []string) ([]Subnet, int, error)
	//
	GetCountByStatus(ctx context.Context, tx *db.Tx, tenantID *uuid.UUID, vpcID *uuid.UUID) (map[string]int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input SubnetUpdateInput) (*Subnet, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input SubnetClearInput) (*Subnet, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
	//
	// GetPrefixUsage returns IPv4 interface usage for this subnet (in-memory IPAM simulation).
	GetPrefixUsage(ctx context.Context, tx *db.Tx, sn *Subnet) (*cipam.Usage, error)
}

SubnetDAO is an interface for interacting with the Subnet model

func NewSubnetDAO

func NewSubnetDAO(dbSession *db.Session) SubnetDAO

NewSubnetDAO returns a new SubnetDAO

type SubnetFilterInput

type SubnetFilterInput struct {
	SubnetIDs    []uuid.UUID
	Names        []string
	SiteIDs      []uuid.UUID
	VpcIDs       []uuid.UUID
	DomainIDs    []uuid.UUID
	TenantIDs    []uuid.UUID
	IPv4BlockIDs []uuid.UUID
	IPv6BlockIDs []uuid.UUID
	Statuses     []string
	SearchQuery  *string
}

SubnetFilterInput input parameters for GetAll method

type SubnetSQLDAO

type SubnetSQLDAO struct {
	SubnetDAO
	// contains filtered or unexported fields
}

SubnetSQLDAO is an implementation of the SubnetDAO interface

func (SubnetSQLDAO) Clear

func (ssd SubnetSQLDAO) Clear(ctx context.Context, tx *db.Tx, input SubnetClearInput) (*Subnet, error)

Clear sets parameters of an existing Subnet to null values in db parameters description, tenantID when true, the are set to null in db since there are 2 operations (UPDATE, SELECT), it is required that this must be within a transaction

func (SubnetSQLDAO) Create

func (ssd SubnetSQLDAO) Create(ctx context.Context, tx *db.Tx, input SubnetCreateInput) (*Subnet, error)

Create creates a new Subnet from the given parameters since there are 2 operations (INSERT, SELECT), in this, it is required that this library call happens within a transaction

func (SubnetSQLDAO) Delete

func (ssd SubnetSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes an Subnet by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (SubnetSQLDAO) GetAll

func (ssd SubnetSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter SubnetFilterInput, page paginator.PageInput, includeRelations []string) ([]Subnet, int, error)

GetAll returns all Subnets filtering by Vpc, Domain, Tenant errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in SubnetOrderByDefault in ascending order

func (SubnetSQLDAO) GetByID

func (ssd SubnetSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Subnet, error)

GetByID returns a Subnet by ID includeRelation can be a subset of Vpc, Domain, Tenant returns db.ErrDoesNotExist error if the record is not found

func (SubnetSQLDAO) GetCountByStatus

func (ssd SubnetSQLDAO) GetCountByStatus(ctx context.Context, tx *db.Tx, tenantID *uuid.UUID, vpcID *uuid.UUID) (map[string]int, error)

GetCountByStatus returns count of Subnets for given status Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned map is 0

func (SubnetSQLDAO) GetPrefixUsage added in v1.6.0

func (ssd SubnetSQLDAO) GetPrefixUsage(ctx context.Context, tx *db.Tx, sn *Subnet) (*cipam.Usage, error)

GetPrefixUsage derives IPv4 interface usage stats for this Subnet via an in-memory IPAM simulation.

func (SubnetSQLDAO) Update

func (ssd SubnetSQLDAO) Update(ctx context.Context, tx *db.Tx, input SubnetUpdateInput) (*Subnet, error)

Update updates specified fields of an existing Subnet The updated fields are assumed to be set to non-null values For setting to null values, use: Clear since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

type SubnetUpdateInput

type SubnetUpdateInput struct {
	SubnetId                   uuid.UUID
	Name                       *string
	Description                *string
	Org                        *string
	SiteID                     *uuid.UUID
	VpcID                      *uuid.UUID
	DomainID                   *uuid.UUID
	TenantID                   *uuid.UUID
	ControllerNetworkSegmentID *uuid.UUID
	IPv4Prefix                 *string
	IPv4Gateway                *string
	IPv4BlockID                *uuid.UUID
	IPv6Prefix                 *string
	IPv6Gateway                *string
	IPv6BlockID                *uuid.UUID
	PrefixLength               *int
	Mtu                        *int
	Status                     *string
	IsMissingOnSite            *bool
}

SubnetUpdateInput parameters for Update method

type Team

type Team struct {
	ID       int      `json:"id"`
	Name     string   `json:"name"`
	TeamType string   `json:"teamType"`
	Roles    []string `json:"roles"`
}

Team captures details for NGC teams

func (Team) Equal

func (t Team) Equal(other Team) bool

Equal compares two Team structs, ignoring order in slices

type Tenant

type Tenant struct {
	bun.BaseModel `bun:"table:tenant,alias:tn"`

	ID             uuid.UUID     `bun:"type:uuid,pk"`
	Name           string        `bun:"name,notnull"`
	DisplayName    *string       `bun:"display_name"`
	Org            string        `bun:"org,notnull"`
	OrgDisplayName *string       `bun:"org_display_name"`
	Config         *TenantConfig `bun:"config,type:jsonb,notnull,default:'{}'::jsonb"`
	Created        time.Time     `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated        time.Time     `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted        *time.Time    `bun:"deleted,soft_delete"`
	CreatedBy      uuid.UUID     `bun:"type:uuid,notnull"`
}

Tenant represents entries in the tenant table

func TestBuildTenant

func TestBuildTenant(t *testing.T, dbSession *db.Session, name string, org string, user *User) *Tenant

TestBuildTenant creates a test Tenant

func (*Tenant) BeforeAppendModel

func (tn *Tenant) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*Tenant) ToCreateRequestProto

func (tn *Tenant) ToCreateRequestProto() *cwssaws.CreateTenantRequest

ToCreateRequestProto builds a CreateTenantRequest proto for sending this Tenant to a Site. Falls back to Org for the metadata Name when OrgDisplayName isn't set.

func (*Tenant) ToUpdateRequestProto

func (tn *Tenant) ToUpdateRequestProto() *cwssaws.UpdateTenantRequest

ToUpdateRequestProto builds an UpdateTenantRequest proto for sending this Tenant to a Site.

type TenantAccount

type TenantAccount struct {
	bun.BaseModel `bun:"table:tenant_account,alias:ta"`

	ID                        uuid.UUID               `bun:"type:uuid,pk"`
	AccountNumber             string                  `bun:"account_number,unique,notnull"`
	TenantID                  *uuid.UUID              `bun:"tenant_id,type:uuid"`
	Tenant                    *Tenant                 `bun:"rel:belongs-to,join:tenant_id=id"`
	TenantOrg                 string                  `bun:"tenant_org,notnull"`
	InfrastructureProviderID  uuid.UUID               `bun:"infrastructure_provider_id,type:uuid,notnull"`
	InfrastructureProvider    *InfrastructureProvider `bun:"rel:belongs-to,join:infrastructure_provider_id=id"`
	InfrastructureProviderOrg string                  `bun:"infrastructure_provider_org,notnull"`
	SubscriptionID            *string                 `bun:"subscription_id"`
	SubscriptionTier          *string                 `bun:"subscription_tier"`
	TenantContactID           *uuid.UUID              `bun:"tenant_contact_id,type:uuid"`
	TenantContact             *User                   `bun:"rel:belongs-to,join:tenant_contact_id=id"`
	Status                    string                  `bun:"status,notnull"`
	Created                   time.Time               `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                   time.Time               `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                   *time.Time              `bun:"deleted,soft_delete"`
	CreatedBy                 uuid.UUID               `bun:"type:uuid,notnull"`
}

TenantAccount represents a tenant account - the relationship between a Tenant and an Infrastructure Provider

func (*TenantAccount) BeforeAppendModel

func (ta *TenantAccount) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*TenantAccount) BeforeCreateTable

func (ta *TenantAccount) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type TenantAccountCreateInput

type TenantAccountCreateInput struct {
	AccountNumber             string
	TenantID                  *uuid.UUID
	TenantOrg                 string
	InfrastructureProviderID  uuid.UUID
	InfrastructureProviderOrg string
	SubscriptionID            *string
	SubscriptionTier          *string
	Status                    string
	CreatedBy                 uuid.UUID
}

TenantAcccountCreateInput parameters for Create method

type TenantAccountDAO

type TenantAccountDAO interface {
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*TenantAccount, error)
	//
	GetByAccountNumber(ctx context.Context, tx *db.Tx, accountNumber string, includeRelations []string) (*TenantAccount, error)
	//
	GetCountByStatus(ctx context.Context, tx *db.Tx, infrastructureProviderID *uuid.UUID, tenantID *uuid.UUID) (map[string]int, error)
	//
	GetCount(ctx context.Context, tx *db.Tx, filter TenantAccountFilterInput) (int, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter TenantAccountFilterInput, page paginator.PageInput, includeRelations []string) ([]TenantAccount, int, error)
	//
	Create(ctx context.Context, tx *db.Tx, input TenantAccountCreateInput) (*TenantAccount, error)
	//
	Update(ctx context.Context, tx *db.Tx, input TenantAccountUpdateInput) (*TenantAccount, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

TenantAccountDAO is an interface for interacting with the TenantAccount model

func NewTenantAccountDAO

func NewTenantAccountDAO(dbSession *db.Session) TenantAccountDAO

NewTenantAccountDAO creates a new TenantAccountDAO

type TenantAccountFilterInput

type TenantAccountFilterInput struct {
	InfrastructureProviderID *uuid.UUID
	Statuses                 []string
	TenantIDs                []uuid.UUID
	TenantOrgs               []string
	SearchQuery              *string
}

TenantAccountFilterInput filtering options for GetAll and GetCount method, including SearchQuery for filtering by account or tenant org

type TenantAccountSQLDAO

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

TenantAccountSQLDAO is an implementation of the TenantAccountDAO interface

func (TenantAccountSQLDAO) Create

Create creates a new TenantAccount from the given parameters

func (TenantAccountSQLDAO) Delete

func (tasd TenantAccountSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes a TenantAccount by ID

func (TenantAccountSQLDAO) GetAll

func (tasd TenantAccountSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter TenantAccountFilterInput, page paginator.PageInput, includeRelations []string) ([]TenantAccount, int, error)

GetAll returns a list of TenantAccounts filtering by tenantID, tenantOrg, infrastructureProviderID, offset, limit and orderBy if orderBy is nil, then records are ordered by column specified in TenantAccountOrderByDefault in ascending order

func (TenantAccountSQLDAO) GetByAccountNumber

func (tasd TenantAccountSQLDAO) GetByAccountNumber(ctx context.Context, tx *db.Tx, accountNumber string, includeRelations []string) (*TenantAccount, error)

GetByAccountNumber returns a TenantAccount by account number

func (TenantAccountSQLDAO) GetByID

func (tasd TenantAccountSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*TenantAccount, error)

GetByID returns a TenantAccount by ID

func (TenantAccountSQLDAO) GetCount

func (tasd TenantAccountSQLDAO) GetCount(ctx context.Context, tx *db.Tx, filter TenantAccountFilterInput) (int, error)

GetCount returns the count of TenantAccounts that match the parameters

func (TenantAccountSQLDAO) GetCountByStatus

func (tasd TenantAccountSQLDAO) GetCountByStatus(ctx context.Context, tx *db.Tx, infrastructureProviderID *uuid.UUID, tenantID *uuid.UUID) (map[string]int, error)

GetCountByStatus returns count of TenantAccounts for given status

func (TenantAccountSQLDAO) Update

Update updates an existing TenantAccount from the given parameters

type TenantAccountUpdateInput

type TenantAccountUpdateInput struct {
	TenantAccountID  uuid.UUID
	TenantID         *uuid.UUID
	SubscriptionID   *string
	SubscriptionTier *string
	TenantContactID  *uuid.UUID
	Status           *string
}

TenantAccountUpdateInput parameters for Update method

type TenantConfig

type TenantConfig struct {
	EnableSSHAccess          bool `json:"enableSshAccess"`
	TargetedInstanceCreation bool `json:"targetedInstanceCreation"`
}

TenantConfig is a data structure to capture configuration and capabilities for a Tenant TODO: EnableSSHAccess is deprecated and should be removed.

type TenantDAO

type TenantDAO interface {
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Tenant, error)
	//
	GetAllByOrg(ctx context.Context, tx *db.Tx, org string, includeRelations []string) ([]Tenant, error)
	//
	CreateFromParams(ctx context.Context, tx *db.Tx, name string, displayName *string, org string, orgDisplayName *string, config *TenantConfig, createdBy *User) (*Tenant, error)
	//
	UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, name *string, displayName *string, orgDisplayName *string, config *TenantConfig) (*Tenant, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

TenantDAO is the data access interface for Tenant

func NewTenantDAO

func NewTenantDAO(dbSession *db.Session) TenantDAO

NewTenantDAO creates and returns a new data access object for Tenant

type TenantSQLDAO

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

TenantSQLDAO implements TenantDAO interface for SQL

func (TenantSQLDAO) CreateFromParams

func (tsd TenantSQLDAO) CreateFromParams(ctx context.Context, tx *db.Tx, name string, displayName *string, org string, orgDisplayName *string, config *TenantConfig, createdBy *User) (*Tenant, error)

CreateFromParams creates a new Tenant from parameters

func (TenantSQLDAO) DeleteByID

func (tsd TenantSQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error

DeleteByID deletes a Tenant by ID

func (TenantSQLDAO) GetAllByOrg

func (tsd TenantSQLDAO) GetAllByOrg(ctx context.Context, tx *db.Tx, org string, includeRelations []string) ([]Tenant, error)

GetAllByOrg returns all Tenants for an Org

func (TenantSQLDAO) GetByID

func (tsd TenantSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Tenant, error)

GetByID returns a Tenant by ID

func (TenantSQLDAO) UpdateFromParams

func (tsd TenantSQLDAO) UpdateFromParams(ctx context.Context, tx *db.Tx, id uuid.UUID, name *string, displayName *string, orgDisplayName *string, config *TenantConfig) (*Tenant, error)

UpdateFromParams updates the InfrastructureProvider with the given parameters

type TenantSite

type TenantSite struct {
	bun.BaseModel `bun:"table:tenant_site,alias:ts"`

	ID                  uuid.UUID              `bun:"type:uuid,pk"`
	TenantID            uuid.UUID              `bun:"tenant_id,type:uuid,notnull"`
	Tenant              *Tenant                `bun:"rel:belongs-to,join:tenant_id=id"`
	TenantOrg           string                 `bun:"tenant_org,notnull"`
	SiteID              uuid.UUID              `bun:"site_id,type:uuid,notnull"`
	Site                *Site                  `bun:"rel:belongs-to,join:site_id=id"`
	EnableSerialConsole bool                   `bun:"enable_serial_console,notnull"`
	Config              map[string]interface{} `bun:"config,type:jsonb,json_use_number"`
	Created             time.Time              `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated             time.Time              `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted             *time.Time             `bun:"deleted,soft_delete"`
	CreatedBy           uuid.UUID              `bun:"type:uuid,notnull"`
}

TenantSite captures the relationship between a Tenant and a Site

func TestBuildTenantSite

func TestBuildTenantSite(t *testing.T, dbSession *db.Session, tn *Tenant, st *Site, config map[string]interface{}, user *User) *TenantSite

TestBuildTenantSite creates a test Tenant/Site relationship

func (*TenantSite) BeforeAppendModel

func (ts *TenantSite) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*TenantSite) BeforeCreateTable

func (ts *TenantSite) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type TenantSiteCreateInput

type TenantSiteCreateInput struct {
	TenantID  uuid.UUID
	TenantOrg string
	SiteID    uuid.UUID
	Config    map[string]interface{}
	CreatedBy uuid.UUID
}

TenantSiteCreateInput input parameters for Create method

type TenantSiteDAO

type TenantSiteDAO interface {
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*TenantSite, error)
	//
	GetByTenantIDAndSiteID(ctx context.Context, tx *db.Tx, tenantID uuid.UUID, siteID uuid.UUID, includeRelations []string) (*TenantSite, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter TenantSiteFilterInput, page paginator.PageInput, includeRelations []string) ([]TenantSite, int, error)
	//
	Create(ctx context.Context, tx *db.Tx, input TenantSiteCreateInput) (*TenantSite, error)
	//
	Update(ctx context.Context, tx *db.Tx, input TenantSiteUpdateInput) (*TenantSite, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

TenantSiteDAO is an interface for interacting with the TenantSite model

func NewTenantSiteDAO

func NewTenantSiteDAO(dbSession *db.Session) TenantSiteDAO

NewTenantSiteDAO creates a new TenantSiteDAO

type TenantSiteFilterInput

type TenantSiteFilterInput struct {
	TenantIDs  []uuid.UUID
	TenantOrgs []string
	SiteIDs    []uuid.UUID
	ConfigKey  *string
	ConfigVal  *string
}

type TenantSiteSQLDAO

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

TenantSiteSQLDAO is an implementation of the TenantSiteDAO interface

func (TenantSiteSQLDAO) Create

func (tssd TenantSiteSQLDAO) Create(ctx context.Context, tx *db.Tx, input TenantSiteCreateInput) (*TenantSite, error)

Create creates a new TenantSite from the given parameters

func (TenantSiteSQLDAO) Delete

func (tssd TenantSiteSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes a TenantSite by ID

func (TenantSiteSQLDAO) GetAll

func (tssd TenantSiteSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter TenantSiteFilterInput, page paginator.PageInput, includeRelations []string) ([]TenantSite, int, error)

GetAll returns a list of TenantSites filtered by tenantID, tenantOrg, siteID, offset, limit and orderBy if orderBy is nil, then records are ordered by column specified in TenantSiteOrderByDefault in ascending order

func (TenantSiteSQLDAO) GetByID

func (tssd TenantSiteSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*TenantSite, error)

GetByID returns a TenantSite by ID

func (TenantSiteSQLDAO) GetByTenantIDAndSiteID

func (tssd TenantSiteSQLDAO) GetByTenantIDAndSiteID(ctx context.Context, tx *db.Tx, tenantID uuid.UUID, siteID uuid.UUID, includeRelations []string) (*TenantSite, error)

GetByTenantIDAndSiteID returns a TenantSite by Tenant ID and Site ID If there are more than one entry for the same Tenant ID and Site ID (which is not a normal case), it will return the first one TODO: Add a unique constraint on Tenant ID, Site ID and deleted

func (TenantSiteSQLDAO) Update

func (tssd TenantSiteSQLDAO) Update(ctx context.Context, tx *db.Tx, input TenantSiteUpdateInput) (*TenantSite, error)

Update updates an existing TenantSite from the given parameters

type TenantSiteUpdateInput

type TenantSiteUpdateInput struct {
	TenantSiteID        uuid.UUID
	EnableSerialConsole *bool
	Config              map[string]interface{}
}

TenantSiteUpdateInput input parameters for Update method

type User

type User struct {
	bun.BaseModel `bun:"table:user,alias:u"`
	ID            uuid.UUID `bun:"type:uuid,pk"`
	AuxiliaryID   *string   `bun:"auxiliary_id,unique"`
	StarfleetID   *string   `bun:"starfleet_id,unique"`
	Email         *string   `bun:"email"`
	FirstName     *string   `bun:"first_name"`
	LastName      *string   `bun:"last_name"`
	NgcOrgData    OrgData   `bun:"ngc_org_data,json_use_number"`
	OrgData       OrgData   `bun:"org_data,type:jsonb,notnull,default:'{}'::jsonb"`
	Created       time.Time `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated       time.Time `bun:"updated,nullzero,notnull,default:current_timestamp"`
}

User represents entries in the user table

func TestBuildUser

func TestBuildUser(t *testing.T, dbSession *db.Session, starfleetID string, org string, roles []string) *User

TestBuildUser creates a test User

func (*User) BeforeAppendModel

func (u *User) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

type UserCreateInput

type UserCreateInput struct {
	AuxiliaryID *string
	StarfleetID *string
	Email       *string
	FirstName   *string
	LastName    *string
	OrgData     OrgData
}

UserCreateInput input parameters for Create method

type UserDAO

type UserDAO interface {
	//
	Get(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*User, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter UserFilterInput, page paginator.PageInput, includeRelations []string) ([]User, int, error)
	//
	Create(ctx context.Context, tx *db.Tx, input UserCreateInput) (*User, error)
	//
	Update(ctx context.Context, tx *db.Tx, input UserUpdateInput) (*User, error)
	//
	GetOrCreate(ctx context.Context, tx *db.Tx, input UserGetOrCreateInput) (*User, bool, error)
}

UserDAO is the interface for the User model

func NewUserDAO

func NewUserDAO(dbSession *db.Session) UserDAO

NewUserDAO creates a new UserDAO

type UserFilterInput

type UserFilterInput struct {
	UserIDs      []uuid.UUID
	AuxiliaryIDs []string
	StarfleetIDs []string
}

UserFilterInput input parameters for GetAll method

type UserGetOrCreateInput

type UserGetOrCreateInput struct {
	AuxiliaryID *string
	StarfleetID *string
}

UserGetOrCreateInput input parameters for GetOrCreate method

type UserSQLDAO

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

UserSQLDAO is the SQL implementation of UserDAO

func (UserSQLDAO) Create

func (usd UserSQLDAO) Create(ctx context.Context, tx *db.Tx, input UserCreateInput) (*User, error)

Create creates a new user from the given input

func (UserSQLDAO) Get

func (usd UserSQLDAO) Get(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*User, error)

Get returns a user by ID

func (UserSQLDAO) GetAll

func (usd UserSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter UserFilterInput, page paginator.PageInput, includeRelations []string) ([]User, int, error)

GetAll returns all Users for given params if orderBy is nil, then records are ordered by column specified in UserOrderByDefault in ascending order

func (UserSQLDAO) GetOrCreate

func (usd UserSQLDAO) GetOrCreate(ctx context.Context, tx *db.Tx, input UserGetOrCreateInput) (*User, bool, error)

GetOrCreate returns a user by AuxiliaryID and/or StarfleetID, or creates a new one if it doesn't exist The database unique constraints prevent race conditions during concurrent user creation. Returns db.ErrInvalidParams if neither ID is provided

func (UserSQLDAO) Update

func (usd UserSQLDAO) Update(ctx context.Context, tx *db.Tx, input UserUpdateInput) (*User, error)

Update updates a user from the given input

type UserUpdateInput

type UserUpdateInput struct {
	UserID      uuid.UUID
	AuxiliaryID *string
	StarfleetID *string
	Email       *string
	FirstName   *string
	LastName    *string
	OrgData     OrgData
}

UserUpdateInput input parameters for Update method

type Vpc

type Vpc struct {
	bun.BaseModel `bun:"table:vpc,alias:v"`

	ID                                     uuid.UUID                               `bun:"type:uuid,pk"`
	Name                                   string                                  `bun:"name,notnull"`
	Description                            *string                                 `bun:"description"`
	Org                                    string                                  `bun:"org,notnull"`
	InfrastructureProviderID               uuid.UUID                               `bun:"infrastructure_provider_id,type:uuid,notnull"`
	InfrastructureProvider                 *InfrastructureProvider                 `bun:"rel:belongs-to,join:infrastructure_provider_id=id"`
	TenantID                               uuid.UUID                               `bun:"tenant_id,type:uuid,notnull"`
	Tenant                                 *Tenant                                 `bun:"rel:belongs-to,join:tenant_id=id"`
	SiteID                                 uuid.UUID                               `bun:"site_id,type:uuid,notnull"`
	Site                                   *Site                                   `bun:"rel:belongs-to,join:site_id=id"`
	NVLinkLogicalPartitionID               *uuid.UUID                              `bun:"nvlink_logical_partition_id,type:uuid"`
	NVLinkLogicalPartition                 *NVLinkLogicalPartition                 `bun:"rel:belongs-to,join:nvlink_logical_partition_id=id"`
	NetworkVirtualizationType              *string                                 `bun:"network_virtualization_type"`
	RoutingProfile                         *string                                 `bun:"routing_profile"`
	ControllerVpcID                        *uuid.UUID                              `bun:"controller_vpc_id,type:uuid"`
	ActiveVni                              *int                                    `bun:"active_vni,type:integer"`
	NetworkSecurityGroupID                 *string                                 `bun:"network_security_group_id"`
	NetworkSecurityGroup                   *NetworkSecurityGroup                   `bun:"rel:belongs-to,join:network_security_group_id=id"`
	NetworkSecurityGroupPropagationDetails *NetworkSecurityGroupPropagationDetails `bun:"network_security_group_propagation_details,type:jsonb"`
	Labels                                 Labels                                  `bun:"labels,type:jsonb"`
	Status                                 string                                  `bun:"status,notnull"`
	IsMissingOnSite                        bool                                    `bun:"is_missing_on_site,notnull"`
	Created                                time.Time                               `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated                                time.Time                               `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted                                *time.Time                              `bun:"deleted,soft_delete"`
	CreatedBy                              uuid.UUID                               `bun:"type:uuid,notnull"`
	Vni                                    *int                                    `bun:"vni,type:integer"`
}

Vpc represents entries in the vpc table

func TestBuildVPC

func TestBuildVPC(t *testing.T, dbSession *db.Session, name string, ip *InfrastructureProvider, tn *Tenant, st *Site, networkVirtualizationType *string, controllerID *uuid.UUID, labels map[string]string, status string, user *User, nsgID *string) *Vpc

TestBuildVPC creates a test VPC

func (*Vpc) BeforeAppendModel

func (v *Vpc) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*Vpc) BeforeCreateTable

func (v *Vpc) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

func (*Vpc) FromProto added in v1.6.0

func (vpc *Vpc) FromProto(proto *cwssaws.Vpc)

FromProto populates this VPC from its workflow proto representation. A nil proto is a no-op. This is the inverse of `ToProto` and exists for convention symmetry — currently no code path on the cloud side reconstructs a full VPC entity from a `cwssaws.Vpc` (the site is the destination, not the source), but the method is provided so future reconciliation flows have a single canonical entry point.

Field-level contract:

  • `vpc.ID` is preserved on a missing or unparseable `proto.Id`, because callers pre-validate the UUID before calling.
  • `Name` is sourced from `proto.Metadata.Name` when set, falling back to the (deprecated) top-level `proto.Name` so the method keeps working through the deprecation window.
  • Optional pointer fields (NetworkSecurityGroupID, NVLinkLogicalPartitionID) are cleared when the proto omits them OR when the proto value is invalid (e.g. an unparseable UUID). This makes `FromProto` a clean reset rather than a partial merge, matching the Expected* pattern.

func (*Vpc) GetSiteID

func (vpc *Vpc) GetSiteID() *uuid.UUID

GetSiteID returns the VPC ID to use when communicating with the Site: the controller-supplied ControllerVpcID when present, otherwise the VPC's own ID. The Site treats both as opaque identifiers.

func (*Vpc) ToDeletionRequestProto

func (vpc *Vpc) ToDeletionRequestProto() *cwssaws.VpcDeletionRequest

ToDeletionRequestProto builds the workflow request that asks a Site to delete this VPC.

func (*Vpc) ToProto added in v1.6.0

func (vpc *Vpc) ToProto() *cwssaws.Vpc

ToProto converts this VPC into its workflow proto representation. Used as the canonical entity-to-proto conversion; request-shape protos (create / update) are produced by `ToProto` methods on the corresponding API request types in api/pkg/api/model/vpc.go.

`NetworkVirtualizationType` is mapped from the DB column's string value to the workflow enum (defaulting to `ETHERNET_VIRTUALIZER` when the string is set but unrecognized, matching the pre-refactor handler behaviour). It is omitted from the proto when the DB column is nil.

type VpcClearInput

type VpcClearInput struct {
	VpcID                                  uuid.UUID
	Description                            bool
	ControllerVpcID                        bool
	RoutingProfile                         bool
	NVLinkLogicalPartitionID               bool
	NetworkSecurityGroupID                 bool
	NetworkSecurityGroupPropagationDetails bool
	Labels                                 bool
}

VpcClearInput input parameters for Clear method

type VpcCreateInput

type VpcCreateInput struct {
	Name                                   string
	Description                            *string
	Org                                    string
	ID                                     *uuid.UUID
	InfrastructureProviderID               uuid.UUID
	TenantID                               uuid.UUID
	SiteID                                 uuid.UUID
	NVLinkLogicalPartitionID               *uuid.UUID
	NetworkVirtualizationType              *string
	RoutingProfile                         *string
	ControllerVpcID                        *uuid.UUID
	NetworkSecurityGroupID                 *string
	NetworkSecurityGroupPropagationDetails *NetworkSecurityGroupPropagationDetails
	Labels                                 map[string]string
	Status                                 string
	CreatedBy                              User
	Vni                                    *int
}

VpcCreateInput input parameters for Create method

type VpcDAO

type VpcDAO interface {
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Vpc, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter VpcFilterInput, page paginator.PageInput, includeRelations []string) ([]Vpc, int, error)
	//
	GetCountByStatus(ctx context.Context, tx *db.Tx, infrastructureProviderID *uuid.UUID, tenantID *uuid.UUID, siteID *uuid.UUID) (map[string]int, error)
	//
	Create(ctx context.Context, tx *db.Tx, input VpcCreateInput) (*Vpc, error)
	//
	Update(ctx context.Context, tx *db.Tx, input VpcUpdateInput) (*Vpc, error)
	//
	Clear(ctx context.Context, tx *db.Tx, input VpcClearInput) (*Vpc, error)
	//
	DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error
}

VpcDAO is an interface for interacting with the Vpc model

func NewVpcDAO

func NewVpcDAO(dbSession *db.Session) VpcDAO

NewVpcDAO returns a new VpcDAO

type VpcFilterInput

type VpcFilterInput struct {
	Name                      *string
	VpcIDs                    []uuid.UUID
	InfrastructureProviderID  *uuid.UUID
	TenantIDs                 []uuid.UUID
	SiteIDs                   []uuid.UUID
	NVLinkLogicalPartitionIDs []uuid.UUID
	NetworkSecurityGroupIDs   []string
	Org                       *string
	NetworkVirtualizationType *string
	Statuses                  []string
	SearchQuery               *string
}

VpcFilterInput input parameters for Filter method

type VpcPeering

type VpcPeering struct {
	bun.BaseModel `bun:"table:vpc_peering,alias:vp"`

	ID     uuid.UUID `bun:"id,type:uuid,pk,default:gen_random_uuid(),notnull"`
	Vpc1ID uuid.UUID `bun:"vpc1_id,type:uuid,notnull"`
	Vpc1   *Vpc      `bun:"rel:belongs-to,join:vpc1_id=id"`
	Vpc2ID uuid.UUID `bun:"vpc2_id,type:uuid,notnull"`
	Vpc2   *Vpc      `bun:"rel:belongs-to,join:vpc2_id=id"`
	SiteID uuid.UUID `bun:"site_id,type:uuid,notnull"`
	Site   *Site     `bun:"rel:belongs-to,join:site_id=id"`

	IsMultiTenant bool `bun:"is_multi_tenant,notnull"`

	InfrastructureProviderID *uuid.UUID              `bun:"infrastructure_provider_id,type:uuid"`
	InfrastructureProvider   *InfrastructureProvider `bun:"rel:belongs-to,join:infrastructure_provider_id=id"`
	TenantID                 *uuid.UUID              `bun:"tenant_id,type:uuid"`
	Tenant                   *Tenant                 `bun:"rel:belongs-to,join:tenant_id=id"`

	Status string `bun:"status,notnull"`

	Created   time.Time  `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated   time.Time  `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted   *time.Time `bun:"deleted,soft_delete"`
	CreatedBy uuid.UUID  `bun:"type:uuid,notnull"`
}

func (*VpcPeering) BeforeCreateTable

func (vp *VpcPeering) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type VpcPeeringCreateInput

type VpcPeeringCreateInput struct {
	Vpc1ID                   uuid.UUID
	Vpc2ID                   uuid.UUID
	SiteID                   uuid.UUID
	IsMultiTenant            bool
	InfrastructureProviderID *uuid.UUID
	TenantID                 *uuid.UUID
	CreatedByID              uuid.UUID
}

type VpcPeeringDAO

type VpcPeeringDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input VpcPeeringCreateInput) (*VpcPeering, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter VpcPeeringFilterInput, page paginator.PageInput, includeRelations []string) ([]VpcPeering, int, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*VpcPeering, error)
	//
	UpdateStatusByID(ctx context.Context, tx *db.Tx, id uuid.UUID, newStatus string) error
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
	//
	DeleteByVpcID(ctx context.Context, tx *db.Tx, vpcID uuid.UUID) error
}

func NewVpcPeeringDAO

func NewVpcPeeringDAO(dbSession *db.Session) VpcPeeringDAO

type VpcPeeringFilterInput

type VpcPeeringFilterInput struct {
	IDs                       []uuid.UUID
	VpcIDs                    []uuid.UUID // Return record if vpc1_id IN (VpcIDs) OR vpc2_id IN (VpcIDs)
	SiteIDs                   []uuid.UUID
	IsMultiTenant             *bool
	InfrastructureProviderIDs []uuid.UUID
	TenantIDs                 []uuid.UUID
	Statuses                  []string
}

type VpcPeeringSQLDAO

type VpcPeeringSQLDAO struct {
	VpcPeeringDAO
	// contains filtered or unexported fields
}

func (VpcPeeringSQLDAO) Create

func (vpsd VpcPeeringSQLDAO) Create(
	ctx context.Context,
	tx *db.Tx,
	input VpcPeeringCreateInput,
) (*VpcPeering, error)

Create inserts a new VPC peering record into the database without checking for duplicates. It bypasses any uniqueness constraints, so duplicate detection must be handled externally, such as within the cloud API handler before calling this method.

func (VpcPeeringSQLDAO) Delete

func (vpsd VpcPeeringSQLDAO) Delete(
	ctx context.Context,
	tx *db.Tx,
	id uuid.UUID,
) error

func (VpcPeeringSQLDAO) DeleteByVpcID

func (vpsd VpcPeeringSQLDAO) DeleteByVpcID(
	ctx context.Context,
	tx *db.Tx,
	vpcID uuid.UUID,
) error

func (VpcPeeringSQLDAO) GetAll

func (vpsd VpcPeeringSQLDAO) GetAll(
	ctx context.Context,
	tx *db.Tx,
	filter VpcPeeringFilterInput,
	page paginator.PageInput,
	includeRelations []string,
) ([]VpcPeering, int, error)

func (VpcPeeringSQLDAO) GetByID

func (vpsd VpcPeeringSQLDAO) GetByID(
	ctx context.Context,
	tx *db.Tx,
	id uuid.UUID,
	includeRelations []string,
) (*VpcPeering, error)

func (VpcPeeringSQLDAO) UpdateStatusByID

func (vpsd VpcPeeringSQLDAO) UpdateStatusByID(
	ctx context.Context,
	tx *db.Tx,
	id uuid.UUID,
	newStatus string,
) error

type VpcPrefix

type VpcPrefix struct {
	bun.BaseModel `bun:"table:vpc_prefix,alias:vp"`

	ID              uuid.UUID  `bun:"type:uuid,pk"`
	Name            string     `bun:"name,notnull"`
	Org             string     `bun:"org,notnull"`
	SiteID          uuid.UUID  `bun:"site_id,type:uuid,notnull"`
	Site            *Site      `bun:"rel:belongs-to,join:site_id=id"`
	VpcID           uuid.UUID  `bun:"vpc_id,type:uuid,notnull"`
	Vpc             *Vpc       `bun:"rel:belongs-to,join:vpc_id=id"`
	TenantID        uuid.UUID  `bun:"tenant_id,type:uuid"`
	Tenant          *Tenant    `bun:"rel:belongs-to,join:tenant_id=id"`
	IPBlockID       *uuid.UUID `bun:"ip_block_id,type:uuid"`
	IPBlock         *IPBlock   `bun:"rel:belongs-to,join:ip_block_id=id"`
	Prefix          string     `bun:"prefix,notnull"`
	PrefixLength    int        `bun:"prefix_length,notnull"`
	Status          string     `bun:"status,notnull"`
	IsMissingOnSite bool       `bun:"is_missing_on_site,notnull"`
	Created         time.Time  `bun:"created,nullzero,notnull,default:current_timestamp"`
	Updated         time.Time  `bun:"updated,nullzero,notnull,default:current_timestamp"`
	Deleted         *time.Time `bun:"deleted,soft_delete"`
	CreatedBy       uuid.UUID  `bun:"type:uuid,notnull"`
}

VpcPrefix is a network construct for bare-metal machines

func (*VpcPrefix) BeforeAppendModel

func (vp *VpcPrefix) BeforeAppendModel(ctx context.Context, query bun.Query) error

BeforeAppendModel is a hook that is called before the model is appended to the query

func (*VpcPrefix) BeforeCreateTable

func (vp *VpcPrefix) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

BeforeCreateTable is a hook that is called before the table is created

type VpcPrefixCreateInput

type VpcPrefixCreateInput struct {
	VpcPrefixID  *uuid.UUID
	Name         string
	TenantOrg    string
	SiteID       uuid.UUID
	VpcID        uuid.UUID
	TenantID     uuid.UUID
	IpBlockID    *uuid.UUID
	Prefix       string
	PrefixLength int
	Status       string
	CreatedBy    uuid.UUID
}

VpcPrefixCreateInput input parameters for Create method

type VpcPrefixDAO

type VpcPrefixDAO interface {
	//
	Create(ctx context.Context, tx *db.Tx, input VpcPrefixCreateInput) (*VpcPrefix, error)
	//
	GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*VpcPrefix, error)
	//
	GetAll(ctx context.Context, tx *db.Tx, filter VpcPrefixFilterInput, page paginator.PageInput, includeRelations []string) ([]VpcPrefix, int, error)
	//
	Update(ctx context.Context, tx *db.Tx, input VpcPrefixUpdateInput) (*VpcPrefix, error)
	//
	Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error
	//
	// GetPrefixUsage returns IPv4 interface usage for this VPC prefix (in-memory IPAM simulation).
	GetPrefixUsage(ctx context.Context, tx *db.Tx, vp *VpcPrefix) (*cipam.Usage, error)
}

VpcPrefixDAO is an interface for interacting with the VpcPrefix model

func NewVpcPrefixDAO

func NewVpcPrefixDAO(dbSession *db.Session) VpcPrefixDAO

NewVpcPrefixDAO returns a new VpcPrefixDAO

type VpcPrefixFilterInput

type VpcPrefixFilterInput struct {
	VpcPrefixIDs  []uuid.UUID
	Names         []string
	VpcIDs        []uuid.UUID
	TenantOrgs    []string
	TenantIDs     []uuid.UUID
	IpBlockIDs    []uuid.UUID
	SiteIDs       []uuid.UUID
	Statuses      []string
	SearchQuery   *string
	Prefixes      []string
	PrefixLengths []int
}

VpcPrefixFilterInput input parameters for Filter method

type VpcPrefixSQLDAO

type VpcPrefixSQLDAO struct {
	VpcPrefixDAO
	// contains filtered or unexported fields
}

VpcPrefixSQLDAO is an implementation of the VpcPrefixDAO interface

func (VpcPrefixSQLDAO) Create

func (vpsd VpcPrefixSQLDAO) Create(ctx context.Context, tx *db.Tx, input VpcPrefixCreateInput) (*VpcPrefix, error)

Create creates a new VpcPrefix from the given parameters

func (VpcPrefixSQLDAO) Delete

func (vpsd VpcPrefixSQLDAO) Delete(ctx context.Context, tx *db.Tx, id uuid.UUID) error

Delete deletes an VpcPrefix by ID error is returned only if there is a db error if the object being deleted doesnt exist, error is not returned (idempotent delete)

func (VpcPrefixSQLDAO) GetAll

func (vpsd VpcPrefixSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter VpcPrefixFilterInput, page paginator.PageInput, includeRelations []string) ([]VpcPrefix, int, error)

GetAll returns all VpcPrefixs filtering by Vpc, Domain, Tenant errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in VpcPrefixOrderByDefault in ascending order

func (VpcPrefixSQLDAO) GetByID

func (vpsd VpcPrefixSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*VpcPrefix, error)

GetByID returns a VpcPrefix by ID includeRelation can be a subset of Vpc returns db.ErrDoesNotExist error if the record is not found

func (VpcPrefixSQLDAO) GetPrefixUsage added in v1.6.0

func (vpsd VpcPrefixSQLDAO) GetPrefixUsage(ctx context.Context, tx *db.Tx, vp *VpcPrefix) (*cipam.Usage, error)

GetPrefixUsage derives IPv4 interface usage stats for this VpcPrefix via an in-memory IPAM simulation.

func (VpcPrefixSQLDAO) Update

func (vpsd VpcPrefixSQLDAO) Update(ctx context.Context, tx *db.Tx, input VpcPrefixUpdateInput) (*VpcPrefix, error)

Update updates specified fields of an existing VpcPrefix The updated fields are assumed to be set to non-null values For setting to null values, use: Clear since there are 2 operations (UPDATE, SELECT), in this, it is required that this library call happens within a transaction

type VpcPrefixUpdateInput

type VpcPrefixUpdateInput struct {
	VpcPrefixID     uuid.UUID
	Name            *string
	TenantOrg       *string
	VpcID           *uuid.UUID
	TenantID        *uuid.UUID
	IpBlockID       *uuid.UUID
	Prefix          *string
	PrefixLength    *int
	Status          *string
	IsMissingOnSite *bool
}

VpcPrefixUpdateInput input parameters for Update method

type VpcSQLDAO

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

VpcSQLDAO is an implementation of the VpcDAO interface

func (VpcSQLDAO) Clear

func (vsd VpcSQLDAO) Clear(ctx context.Context, tx *db.Tx, input VpcClearInput) (*Vpc, error)

Clear clears VPC attributes based on provided arguments

func (VpcSQLDAO) Create

func (vsd VpcSQLDAO) Create(ctx context.Context, tx *db.Tx, input VpcCreateInput) (*Vpc, error)

Create a new Vpc from the given parameters

func (VpcSQLDAO) DeleteByID

func (vsd VpcSQLDAO) DeleteByID(ctx context.Context, tx *db.Tx, id uuid.UUID) error

DeleteByID deletes a Vpc by ID

func (VpcSQLDAO) GetAll

func (vsd VpcSQLDAO) GetAll(ctx context.Context, tx *db.Tx, filter VpcFilterInput, page paginator.PageInput, includeRelations []string) ([]Vpc, int, error)

GetAll returns all VPCs for a tenant or site Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned slice is 0 if orderBy is nil, then records are ordered by column specified in VpcOrderByDefault in ascending order

func (VpcSQLDAO) GetByID

func (vsd VpcSQLDAO) GetByID(ctx context.Context, tx *db.Tx, id uuid.UUID, includeRelations []string) (*Vpc, error)

GetByID returns a Vpc by ID

func (VpcSQLDAO) GetCountByStatus

func (vsd VpcSQLDAO) GetCountByStatus(ctx context.Context, tx *db.Tx, infrastructureProviderID *uuid.UUID, tenantID *uuid.UUID, siteID *uuid.UUID) (map[string]int, error)

GetCountByStatus returns count of VPCs for given status Errors are returned only when there is a db related error if records not found, then error is nil, but length of returned map is 0

func (VpcSQLDAO) Update

func (vsd VpcSQLDAO) Update(ctx context.Context, tx *db.Tx, input VpcUpdateInput) (*Vpc, error)

Update updates an existing Vpc from the given parameters

type VpcUpdateInput

type VpcUpdateInput struct {
	VpcID                                  uuid.UUID
	Name                                   *string
	Description                            *string
	NetworkVirtualizationType              *string
	RoutingProfile                         *string
	ControllerVpcID                        *uuid.UUID
	ActiveVni                              *int
	NVLinkLogicalPartitionID               *uuid.UUID
	NetworkSecurityGroupID                 *string
	NetworkSecurityGroupPropagationDetails *NetworkSecurityGroupPropagationDetails
	Labels                                 map[string]string
	Status                                 *string
	IsMissingOnSite                        *bool
	Vni                                    *int
}

VpcUpdateInput input parameters for Update method

Jump to

Keyboard shortcuts

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