github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/rpc/params/image_metadata.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package params
     5  
     6  // ImageMetadataFilter holds filter properties used to search for image metadata.
     7  // It amalgamates both simplestreams.MetadataLookupParams and simplestreams.LookupParams
     8  // and adds additional properties to satisfy existing and new use cases.
     9  type ImageMetadataFilter struct {
    10  	// Region stores metadata region.
    11  	Region string `json:"region,omitempty"`
    12  
    13  	// Versions stores all desired versions.
    14  	Versions []string `json:"versions,omitempty"`
    15  
    16  	// Arches stores all desired architectures.
    17  	Arches []string `json:"arches,omitempty"`
    18  
    19  	// Stream can be "" or "released" for the default "released" stream,
    20  	// or "daily" for daily images, or any other stream that the available
    21  	// simplestreams metadata supports.
    22  	Stream string `json:"stream,omitempty"`
    23  
    24  	// VirtType stores virtualisation type.
    25  	VirtType string `json:"virt-type,omitempty"`
    26  
    27  	// RootStorageType stores storage type.
    28  	RootStorageType string `json:"root-storage-type,omitempty"`
    29  }
    30  
    31  // CloudImageMetadata holds cloud image metadata properties.
    32  type CloudImageMetadata struct {
    33  	// ImageId is an image identifier.
    34  	ImageId string `json:"image-id"`
    35  
    36  	// Stream contains reference to a particular stream,
    37  	// for e.g. "daily" or "released"
    38  	Stream string `json:"stream,omitempty"`
    39  
    40  	// Region is the name of cloud region associated with the image.
    41  	Region string `json:"region"`
    42  
    43  	// Version is OS version, for e.g. "22.04".
    44  	Version string `json:"version"`
    45  
    46  	// Arch is the architecture for this cloud image, for e.g. "amd64"
    47  	Arch string `json:"arch"`
    48  
    49  	// VirtType contains the virtualisation type of the cloud image, for e.g. "pv", "hvm". "kvm".
    50  	VirtType string `json:"virt-type,omitempty"`
    51  
    52  	// RootStorageType contains type of root storage, for e.g. "ebs", "instance".
    53  	RootStorageType string `json:"root-storage-type,omitempty"`
    54  
    55  	// RootStorageSize contains size of root storage in gigabytes (GB).
    56  	RootStorageSize *uint64 `json:"root-storage-size,omitempty"`
    57  
    58  	// Source describes where this image is coming from: is it public? custom?
    59  	Source string `json:"source"`
    60  
    61  	// Priority is an importance factor for image metadata.
    62  	// Higher number means higher priority.
    63  	// This will allow to sort metadata by importance.
    64  	Priority int `json:"priority"`
    65  }
    66  
    67  // ListCloudImageMetadataResult holds the results of querying cloud image metadata.
    68  type ListCloudImageMetadataResult struct {
    69  	Result []CloudImageMetadata `json:"result"`
    70  }
    71  
    72  // MetadataSaveParams holds lists of cloud image metadata to save. Each list
    73  // will be saved atomically.
    74  type MetadataSaveParams struct {
    75  	Metadata []CloudImageMetadataList `json:"metadata,omitempty"`
    76  }
    77  
    78  // CloudImageMetadataList holds a list of cloud image metadata.
    79  type CloudImageMetadataList struct {
    80  	Metadata []CloudImageMetadata `json:"metadata,omitempty"`
    81  }
    82  
    83  // MetadataImageIds holds image ids and can be used to identify related image metadata.
    84  type MetadataImageIds struct {
    85  	Ids []string `json:"image-ids"`
    86  }