forked from fujiwara/ecrm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.go
27 lines (23 loc) · 751 Bytes
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package ecrm
import (
"github.com/aws/aws-sdk-go-v2/aws"
ecrTypes "github.com/aws/aws-sdk-go-v2/service/ecr/types"
ociTypes "github.com/google/go-containerregistry/pkg/v1/types"
)
func isContainerImage(d ecrTypes.ImageDetail) bool {
t := ociTypes.MediaType(aws.ToString(d.ArtifactMediaType))
return t == ociTypes.DockerConfigJSON || t == ociTypes.OCIConfigJSON
}
func isImageIndex(d ecrTypes.ImageDetail) bool {
if aws.ToString(d.ArtifactMediaType) != "" {
return false
}
switch ociTypes.MediaType(aws.ToString(d.ImageManifestMediaType)) {
case ociTypes.OCIImageIndex:
return true
}
return false
}
func isSociIndex(d ecrTypes.ImageDetail) bool {
return ociTypes.MediaType(aws.ToString(d.ArtifactMediaType)) == MediaTypeSociIndex
}