mongodb

package
v0.1.54 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientFromConfig

func ClientFromConfig(ctx context.Context, cancel context.CancelFunc) *mongo.Client

func DeleteAllDocumentsInCollection added in v0.1.15

func DeleteAllDocumentsInCollection(collection *mongo.Collection) (results *mongo.DeleteResult)

func GetAllResources

func GetAllResources(coll *mongo.Collection) (documentData []lib.AzureResourceDetails)

func GetBuildDataAndUpdateImageVesionData added in v0.1.15

func GetBuildDataAndUpdateImageVesionData(imageGalleryImagesColl *mongo.Collection)

func MarkImageGalleryImagesUsedByCitrix

func MarkImageGalleryImagesUsedByCitrix(machineCatalogs map[string]citrix.MachineCatalogCurrentImage, collection *mongo.Collection) *mongo.BulkWriteResult

func ResetLifetimeCostValues

func ResetLifetimeCostValues(collection *mongo.Collection) *mongo.BulkWriteResult

Gets all documents from a collection then calculates monthly totals from each costData item and saves the sum back to the cost item's "lifetimeTotalCost" field. Only updates documents if there is a difference

func ResetRelatedResourcesAndCostItems

func ResetRelatedResourcesAndCostItems(collection *mongo.Collection) *mongo.BulkWriteResult

func UpdateADUsers added in v0.1.41

func UpdateADUsers(coll *mongo.Collection)

func UpdateAllAzureResourceIPAddresses added in v0.1.17

func UpdateAllAzureResourceIPAddresses(resIPAddressesColl *mongo.Collection, tokenReq lib.AllTenantTokens)

func UpdateAllCertInfo added in v0.1.26

func UpdateAllCertInfo(certsCaCertInfo *mongo.Collection, serverCertsInfoColl *mongo.Collection)

func UpdateAllGalleryImagesAndUpdateWithUsedByCitrix

func UpdateAllGalleryImagesAndUpdateWithUsedByCitrix(imageGalleryImagesColl *mongo.Collection, machineCatalogsColl *mongo.Collection, tokenReq lib.AllTenantTokens)

func UpdateAzureResourceRelations

func UpdateAzureResourceRelations(transformedData lib.AggregatedCostData, opts UpdateAllAzureResourcesAndVcpuCountsOptions)

func UpdateB2CUsers added in v0.1.51

func UpdateB2CUsers(coll *mongo.Collection)

func UpdateEntraItems

func UpdateEntraItems(opts UpdateEntraItemsOptions, tokenReq lib.AllTenantTokens)

func UpdateEntraPimItems

func UpdateEntraPimItems(opts UpdateEntraPimItemsOptions)

func UpdateImageDataWithBuildHostLogs

func UpdateImageDataWithBuildHostLogs(buildData []lib.PackerLogBuildData, collection *mongo.Collection) *mongo.BulkWriteResult

func UpdateM365Data added in v0.1.46

func UpdateM365Data(coll *mongo.Collection)

func UpdateResourcesNotExistInAzure

func UpdateResourcesNotExistInAzure(azureResources []lib.AzureResourceDetails, collection *mongo.Collection) *mongo.BulkWriteResult

func UpdateSupportAlerts added in v0.1.52

func UpdateSupportAlerts(coll *mongo.Collection)

func UpdateWebsiteCertsPullingFromDatabase added in v0.1.52

func UpdateWebsiteCertsPullingFromDatabase(c *mongo.Client)

func UpsertADUsers added in v0.1.41

func UpsertADUsers(users []ad.ADUser, coll *mongo.Collection) (results *mongo.BulkWriteResult)

func UpsertAzureIPAddresses added in v0.1.17

func UpsertAzureIPAddresses(resources []azure.AzureResourceIPConfig, resIPAddressesColl *mongo.Collection) *mongo.BulkWriteResult

func UpsertB2CUsers added in v0.1.51

func UpsertB2CUsers(users []azure.B2CUserMinimal, coll *mongo.Collection) (results *mongo.BulkWriteResult)

func UpsertCACertificates added in v0.1.26

func UpsertCACertificates(caCertInfo []lib.CertAuthorityCertInfo, coll *mongo.Collection) (results []mongo.BulkWriteResult)

func UpsertCertInfo

func UpsertCertInfo(caCertInfo []lib.CertAuthorityCertInfo, serverCertInfo []lib.ServerCertInfo, caCertsColl *mongo.Collection, serverCertsColl *mongo.Collection) (caResults *mongo.BulkWriteResult, svrResults *mongo.BulkWriteResult)

func UpsertCitrixMachineCatalogs

func UpsertCitrixMachineCatalogs(machineCatalogs citrix.MachineCatalogs, coll *mongo.Collection) (results []mongo.BulkWriteResult)

func UpsertImageGalleryImages

func UpsertImageGalleryImages(images []lib.GalleryImage, collection *mongo.Collection) (results []mongo.BulkWriteResult)

func UpsertMailboxStatistics added in v0.1.46

func UpsertMailboxStatistics(mailboxStats []m365.MailboxUsageDetail, coll *mongo.Collection) (results *mongo.BulkWriteResult)

func UpsertMultipleEntraApps

func UpsertMultipleEntraApps[T azure.EntraApplication | azure.EntraExpiringCredential](apps []T, collection *mongo.Collection) (results []mongo.BulkWriteResult)

func UpsertMultipleMonthlyCostData

func UpsertMultipleMonthlyCostData(
	costExportMonths []string,
	costingTenantsColl *mongo.Collection,
	costingSubsColl *mongo.Collection,
	costingResGrpsColl *mongo.Collection,
	costingResourcesColl *mongo.Collection,
	costingMetersColl *mongo.Collection,
	resourcesTenantsColl *mongo.Collection,
)

func UpsertMultipleResGrps

func UpsertMultipleResGrps(resGrps []azure.ResourceGroup, resourcesListColl *mongo.Collection) *mongo.BulkWriteResult

func UpsertMultipleResources

func UpsertMultipleResources(resources []lib.AzureResourceDetails, resourcesListColl *mongo.Collection) (results []mongo.BulkWriteResult)

func UpsertMultipleResources(resources []lib.AzureResourceDetails, resourcesListColl *mongo.Collection) {

func UpsertMultipleRoleAssignmentScheduleInstances

func UpsertMultipleRoleAssignmentScheduleInstances(ras []azure.RoleAssignmentScheduleInstance, coll *mongo.Collection) *mongo.BulkWriteResult

func UpsertMultipleRoleEligibilityScheduleInstances

func UpsertMultipleRoleEligibilityScheduleInstances(res []azure.RoleEligibilityScheduleInstance, coll *mongo.Collection) *mongo.BulkWriteResult

func UpsertResourceSKUs

func UpsertResourceSKUs(skus []lib.AzureResourceSku, collection *mongo.Collection) (results []mongo.BulkWriteResult)

func UpsertServerCertificates added in v0.1.26

func UpsertServerCertificates(serverCertInfo []lib.ServerCertInfo, coll *mongo.Collection) (results []mongo.BulkWriteResult)

func UpsertStorageAccountMinTlsVersions added in v0.1.31

func UpsertStorageAccountMinTlsVersions(resources []azure.StorageAccountTlsVersion, mongoColl *mongo.Collection) *mongo.BulkWriteResult

func UpsertMultipleResources(resources []lib.AzureResourceDetails, resourcesListColl *mongo.Collection) {

func UpsertSupportAlerts added in v0.1.52

func UpsertSupportAlerts(alerts []azure.AzureAlertProcessed, coll *mongo.Collection) (results *mongo.BulkWriteResult)

func UpsertTenantAndSubs

func UpsertTenantAndSubs(tenantsColl *mongo.Collection, tokenReq *lib.AllTenantTokens) (results *mongo.BulkWriteResult)

func UpsertVcpuCounts

func UpsertVcpuCounts(vcpuCountData lib.VCpuCountByTenant, collection *mongo.Collection) (results []mongo.BulkWriteResult)

Types

type CertManagementConfig added in v0.1.52

type CertManagementConfig struct {
	ID                    string         `json:"_id,omitempty,omitzero" bson:"_id,omitempty,omitzero"`
	PathsToIgnore         []string       `json:"pathsToIgnore,omitempty,omitzero" bson:"pathsToIgnore,omitempty,omitzero"`
	FriendlyNamesToIgnore []FriendlyName `json:"friendlyNamesToIgnore,omitempty,omitzero" bson:"friendlyNamesToIgnore,omitempty,omitzero"`
	SubjectNamesToIgnore  []SubjectName  `json:"subjectNamesToIgnore,omitempty,omitzero" bson:"subjectNamesToIgnore,omitempty,omitzero"`
	IssuersToIgnore       []Issuer       `json:"issuersToIgnore,omitempty,omitzero" bson:"issuersToIgnore,omitempty,omitzero"`
	UrlsToWatch           []struct {
		URL    string `json:"url,omitempty,omitzero" bson:"url,omitempty,omitzero"`
		Name   string `json:"name,omitempty,omitzero" bson:"name,omitempty,omitzero"`
		Tenant string `json:"tenant,omitempty,omitzero" bson:"tenant,omitempty,omitzero"`
	} `json:"urlsToWatch,omitempty,omitzero" bson:"urlsToWatch,omitempty,omitzero"`
}

type FriendlyName added in v0.1.52

type FriendlyName struct {
	FriendlyName         string `json:"friendlyName,omitempty,omitzero" bson:"friendlyName,omitempty,omitzero"`
	IsRegex              bool   `json:"isRegex,omitempty,omitzero" bson:"isRegex,omitempty,omitzero"`
	RegExCaseInsensitive bool   `json:"regExCaseInsensitive,omitempty,omitzero" bson:"regExCaseInsensitive,omitempty,omitzero"`
	RegExStartsWith      bool   `json:"regExStartsWith,omitempty,omitzero" bson:"regExStartsWith,omitempty,omitzero"`
	RegExEndsWith        bool   `json:"regExEndsWith,omitempty,omitzero" bson:"regExEndsWith,omitempty,omitzero"`
}

type Issuer added in v0.1.52

type Issuer struct {
	Issuer               string `json:"issuer,omitempty,omitzero" bson:"issuer,omitempty,omitzero"`
	IsRegex              bool   `json:"isRegex,omitempty,omitzero" bson:"isRegex,omitempty,omitzero"`
	RegExCaseInsensitive bool   `json:"regExCaseInsensitive,omitempty,omitzero" bson:"regExCaseInsensitive,omitempty,omitzero"`
	RegExStartsWith      bool   `json:"regExStartsWith,omitempty,omitzero" bson:"regExStartsWith,omitempty,omitzero"`
	RegExEndsWith        bool   `json:"regExEndsWith,omitempty,omitzero" bson:"regExEndsWith,omitempty,omitzero"`
}

type MongoDbAzureSubscription

type MongoDbAzureSubscription struct {
	DisplayName    string `json:"displayName" bson:"displayName"`
	ResourceID     string `json:"id" bson:"resourceId"`
	SubscriptionID string `json:"subscriptionId" bson:"subscriptionId"`
	TenantId       string `json:"tenantId" bson:"-"`
}

type MongoDbAzureTenant

type MongoDbAzureTenant struct {
	TenantId            string                              `json:"tenantId" bson:"_id"`
	TenantName          string                              `json:"tenantName" bson:"tenantName"`
	CostExportsLocation string                              `json:"costExportsLocation" bson:"costExportsLocation"`
	Subscriptions       map[string]MongoDbAzureSubscription `json:"subscriptions" bson:"subscriptions"`
	Aliases             []string                            `json:"aliases" bson:"aliases"`
}

type SubjectName added in v0.1.52

type SubjectName struct {
	SubjectName          string `json:"subjectName,omitempty,omitzero" bson:"issuer,omitempty,omitzero"`
	IsRegex              bool   `json:"isRegex,omitempty,omitzero" bson:"isRegex,omitempty,omitzero"`
	RegExCaseInsensitive bool   `json:"regExCaseInsensitive,omitempty,omitzero" bson:"regExCaseInsensitive,omitempty,omitzero"`
	RegExStartsWith      bool   `json:"regExStartsWith,omitempty,omitzero" bson:"regExStartsWith,omitempty,omitzero"`
	RegExEndsWith        bool   `json:"regExEndsWith,omitempty,omitzero" bson:"regExEndsWith,omitempty,omitzero"`
}

type UpdateAllAzureResourcesAndVcpuCountsOptions

type UpdateAllAzureResourcesAndVcpuCountsOptions struct {
	SkuListSubscription         string
	SkuListAuth                 lib.CldConfigTenantAuth
	Location                    string
	CostDataMonth               string
	CostDataBlobPrefix          string
	AzResSKUColl                *mongo.Collection
	AzResVcpuCountsColl         *mongo.Collection
	AzStorageAcctMinTlsVersions *mongo.Collection
	EnvOptCostingTenantsColl    *mongo.Collection
	EnvOptCostingSubsColl       *mongo.Collection
	EnvOptCostingResGrpsColl    *mongo.Collection
	EnvOptCostingResourcesColl  *mongo.Collection
	EnvOptCostingMetersColl     *mongo.Collection
	AzResTenantsColl            *mongo.Collection
	AzResResourceListColl       *mongo.Collection
	AzResGrpsListColl           *mongo.Collection
}

type UpdateAllAzureResourcesAndVcpuCountsOptionsOptions

type UpdateAllAzureResourcesAndVcpuCountsOptionsOptions struct {
	AzureResourcesDatabase      string
	CitrixDatabase              string
	AzResImageGalleryImagesColl string
	CitrixMachineCatalogsColl   string
}

type UpdateEntraItemsOptions

type UpdateEntraItemsOptions struct {
	EntraAppRegColl              *mongo.Collection
	EntraAppRegCredsExpiringColl *mongo.Collection
}

type UpdateEntraPimItemsOptions

type UpdateEntraPimItemsOptions struct {
	EntraRoleEligibilityScheduleInstancesColl *mongo.Collection
	EntraRoleAssignmentScheduleInstancesColl  *mongo.Collection
}

type UpsertMonthlyTenantSubResGrpCostsResults

type UpsertMonthlyTenantSubResGrpCostsResults struct {
	UpdateTenants                   *mongo.BulkWriteResult
	UpdateTenantsCostData           *mongo.BulkWriteResult
	UpdateTenantsProcessedUpdates   *mongo.BulkWriteResult
	UpdateSubs                      *mongo.BulkWriteResult
	UpdateSubsCostData              *mongo.BulkWriteResult
	UpdateSubsProcessedUpdates      *mongo.BulkWriteResult
	UpdateResGrps                   *mongo.BulkWriteResult
	UpdateResGrpsCostData           *mongo.BulkWriteResult
	UpdateResGrpsProcessedUpdates   *mongo.BulkWriteResult
	UpdateResources                 *mongo.BulkWriteResult
	UpdateResourcesCostData         *mongo.BulkWriteResult
	UpdateResourcesProcessedUpdates *mongo.BulkWriteResult
	UpdateMeters                    *mongo.BulkWriteResult
	UpdateMetersCostData            *mongo.BulkWriteResult
	UpdateMetersProcessedUpdates    *mongo.BulkWriteResult
}

func UpsertMonthlyTenantSubResGrpCosts

func UpsertMonthlyTenantSubResGrpCosts(
	costData lib.AggregatedCostData,
	costExportMonth string,
	costingTenantsColl *mongo.Collection,
	costingSubsColl *mongo.Collection,
	costingResGrpsColl *mongo.Collection,
	costingResourcesColl *mongo.Collection,
	costingMetersColl *mongo.Collection,
	tenantsColl *mongo.Collection,
) (results UpsertMonthlyTenantSubResGrpCostsResults)

type WebsiteCertificateMinimal added in v0.1.52

type WebsiteCertificateMinimal struct {
	SerialNumber          *big.Int   `json:"serialNumber,omitempty,omitzero" bson:"serialNumber,omitempty,omitzero"`
	Issuer                string     `json:"issuer,omitempty,omitzero" bson:"issuer,omitempty,omitzero"`
	Subject               string     `json:"subject,omitempty,omitzero" bson:"subject,omitempty,omitzero"`
	NotBefore             time.Time  `json:"notBefore,omitempty,omitzero" bson:"notBefore,omitempty,omitzero"`
	NotAfter              time.Time  `json:"notAfter,omitempty,omitzero" bson:"notAfter,omitempty,omitzero"`
	BasicConstraintsValid bool       `json:"basicConstraintsValid,omitempty,omitzero" bson:"basicConstraintsValid,omitempty,omitzero"`
	IsCA                  bool       `json:"isCA,omitempty,omitzero" bson:"isCA,omitempty,omitzero"`
	IssuingCertificateURL []string   `json:"issuingCertificateURL,omitempty,omitzero" bson:"issuingCertificateURL,omitempty,omitzero"`
	DNSNames              []string   `json:"dnsNames,omitempty,omitzero" bson:"dnsNames,omitempty,omitzero"`
	EmailAddresses        []string   `json:"emailAddresses,omitempty,omitzero" bson:"emailAddresses,omitempty,omitzero"`
	IPAddresses           []net.IP   `json:"ipAddresses,omitempty,omitzero" bson:"ipAddresses,omitempty,omitzero"`
	URIs                  []*url.URL `json:"uris,omitempty,omitzero" bson:"uris,omitempty,omitzero"`
	CRLDistributionPoints []string   `json:"crlDistributionPoints,omitempty,omitzero" bson:"crlDistributionPoints,omitempty,omitzero"`
}

Jump to

Keyboard shortcuts

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