MCPcopy Create free account
hub / github.com/BishopFox/cloudfox / getSagemakerEnvironmentVariablesPerRegion

Method getSagemakerEnvironmentVariablesPerRegion

aws/env-vars.go:575–839  ·  view source on GitHub ↗
(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan EnvironmentVariable)

Source from the content-addressed store, hash-verified

573}
574
575func (m *EnvsModule) getSagemakerEnvironmentVariablesPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan EnvironmentVariable) {
576 defer func() {
577 m.CommandCounter.DecrExecuting()
578 m.CommandCounter.IncrComplete()
579 wg.Done()
580
581 }()
582 semaphore <- struct{}{}
583 defer func() {
584 <-semaphore
585 }()
586 // m.CommandCounter.IncrTotal()
587 m.CommandCounter.DecrPending()
588 m.CommandCounter.IncrExecuting()
589 awsService := "Sagemaker"
590
591 var PaginationControl *string
592
593 // Look for envs in processing jobs
594 for {
595 ListProcessingJobs, err := m.SagemakerClient.ListProcessingJobs(
596 context.TODO(),
597 &(sagemaker.ListProcessingJobsInput{
598 NextToken: PaginationControl,
599 }),
600 func(o *sagemaker.Options) {
601 o.Region = r
602 },
603 )
604 if err != nil {
605 m.modLog.Error(err.Error())
606 m.CommandCounter.IncrError()
607 break
608 }
609
610 for _, job := range ListProcessingJobs.ProcessingJobSummaries {
611 jobName := job.ProcessingJobName
612
613 DescribeProcessingJob, err := m.SagemakerClient.DescribeProcessingJob(
614 context.TODO(),
615 &(sagemaker.DescribeProcessingJobInput{
616 ProcessingJobName: jobName,
617 }),
618 func(o *sagemaker.Options) {
619 o.Region = r
620 },
621 )
622 if err != nil {
623 m.modLog.Error(err.Error())
624 m.CommandCounter.IncrError()
625 break
626 }
627
628 if len(DescribeProcessingJob.Environment) > 0 {
629 name := fmt.Sprintf("[Processing Job] %s", aws.ToString(DescribeProcessingJob.ProcessingJobName))
630 for k, v := range DescribeProcessingJob.Environment {
631 dataReceiver <- EnvironmentVariable{
632 service: awsService,

Callers 1

executeChecksMethod · 0.95

Calls 6

DecrExecutingMethod · 0.80
IncrCompleteMethod · 0.80
DecrPendingMethod · 0.80
IncrExecutingMethod · 0.80
ErrorMethod · 0.80
IncrErrorMethod · 0.80

Tested by

no test coverage detected