-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Container Registry] Acr enums #18400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 24 commits
d7bcfe6
7a0b598
15bbaaf
b91302c
6f7c55c
22ecb18
d5986dd
1287136
145949b
09f3636
6e38bf1
d9659c0
af8959d
c355fdd
506c1ef
2ec30e1
09a7d4e
74151e7
7d93184
c32799b
ff9fa17
cc2396f
cf8d784
ec45042
5899334
2788897
a186814
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,8 +6,9 @@ | |
|
|
||
| from enum import Enum | ||
| from typing import TYPE_CHECKING, Dict, Any | ||
| from ._generated.models import ContentProperties as GeneratedContentProperties | ||
|
|
||
| from ._generated.models import RepositoryProperties as GeneratedRepositoryProperties | ||
| from ._generated.models import ContentProperties as GeneratedContentProperties | ||
|
|
||
| if TYPE_CHECKING: | ||
| from ._generated.models import ManifestAttributesBase | ||
|
|
@@ -24,7 +25,7 @@ class ContentProperties(object): | |
| """ | ||
|
|
||
| def __init__(self, **kwargs): | ||
| """Create ContentPermissions for an artifact, tag, or manifest | ||
| """Create ContentProperties for an artifact, tag, or manifest | ||
|
|
||
| :keyword bool can_delete: Delete operation status for the object | ||
| :keyword bool can_list: List operation status for the object | ||
|
|
@@ -78,22 +79,24 @@ def _from_generated(cls, gen): | |
| class ArtifactManifestProperties(object): | ||
| """Represents properties of a registry artifact | ||
|
|
||
| :ivar str cpu_architecture: CPU Architecture of an artifact | ||
| :ivar architecture: CPU Architecture of an artifact | ||
| :vartype architecture: ~azure.containerregistry.ArtifactArchitecture | ||
| :ivar created_on: Time and date an artifact was created | ||
| :vartype created_on: :class:`~datetime.datetime` | ||
| :vartype created_on: datetime.datetime | ||
| :ivar str digest: Digest for the artifact | ||
| :ivar last_updated_on: Time and date an artifact was last updated | ||
| :vartype last_updated_on: :class:`~datetime.datetime` | ||
| :ivar str operating_system: Operating system for the artifact | ||
| :vartype last_updated_on: datetime.datetime | ||
| :ivar operating_system: Operating system for the artifact | ||
| :vartype writeable_properties: ~azure.containerregistry.ArtifactOperatingSystem | ||
|
seankane-msft marked this conversation as resolved.
Outdated
|
||
| :ivar str repository_name: Repository name the artifact belongs to | ||
| :ivar str size: Size of the artifact | ||
| :ivar List[str] tags: Tags associated with a registry artifact | ||
| :ivar writeable_properties: Permissions for an artifact | ||
| :vartype writeable_properties: :class:`~azure.containerregistry.ContentProperties` | ||
| :vartype writeable_properties: ~azure.containerregistry.ContentProperties | ||
| """ | ||
|
|
||
| def __init__(self, **kwargs): | ||
| self.cpu_architecture = kwargs.get("cpu_architecture", None) | ||
| self.architecture = kwargs.get("cpu_architecture", None) | ||
| self.created_on = kwargs.get("created_on", None) | ||
| self.digest = kwargs.get("digest", None) | ||
| self.last_updated_on = kwargs.get("last_updated_on", None) | ||
|
|
@@ -105,6 +108,16 @@ def __init__(self, **kwargs): | |
| if self.writeable_properties: | ||
| self.writeable_properties = ContentProperties._from_generated(self.writeable_properties) | ||
|
|
||
| for data in ArtifactArchitecture: | ||
| if data.value == self.architecture: | ||
| self.architecture = data | ||
| break | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should be able to do
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a result model. The |
||
|
|
||
| for data in ArtifactOperatingSystem: | ||
| if data.value == self.operating_system: | ||
| self.operating_system = data | ||
| break | ||
|
|
||
| @classmethod | ||
| def _from_generated(cls, generated, **kwargs): | ||
| # type: (ManifestAttributesBase, Dict[str, Any]) -> ArtifactManifestProperties | ||
|
|
@@ -125,11 +138,11 @@ class RepositoryProperties(object): | |
| """Model for storing properties of a single repository | ||
|
|
||
| :ivar writeable_properties: Read/Write/List/Delete permissions for the repository | ||
| :vartype writeable_properties: :class:`~azure.containerregistry.ContentProperties` | ||
| :vartype writeable_properties: ~azure.containerregistry.ContentProperties | ||
| :ivar created_on: Time the repository was created | ||
| :vartype created_on: :class:`datetime.datetime` | ||
| :vartype created_on: datetime.datetime | ||
| :ivar last_updated_on: Time the repository was last updated | ||
| :vartype last_updated_on: :class:`datetime.datetime` | ||
| :vartype last_updated_on: datetime.datetime | ||
| :ivar int manifest_count: Number of manifest in the repository | ||
| :ivar str name: Name of the repository | ||
| :ivar int tag_count: Number of tags associated with the repository | ||
|
|
@@ -168,6 +181,17 @@ def _to_generated(self): | |
| writeable_properties=self.writeable_properties._to_generated(), # pylint: disable=protected-access | ||
| ) | ||
|
|
||
| def _to_generated(self): | ||
| # type: () -> GeneratedRepositoryProperties | ||
| return GeneratedRepositoryProperties( | ||
| name=self.name, | ||
| created_on=self.created_on, | ||
| last_updated_on=self.last_updated_on, | ||
| manifest_count=self.manifest_count, | ||
| tag_count=self.tag_count, | ||
| writeable_properties=self.writeable_properties._to_generated(), # pylint: disable=protected-access | ||
| ) | ||
|
|
||
|
|
||
| class ManifestOrder(str, Enum): | ||
| """Enum for ordering registry artifacts""" | ||
|
|
@@ -187,12 +211,12 @@ class ArtifactTagProperties(object): | |
| """Model for storing properties of a single tag | ||
|
|
||
| :ivar writeable_properties: Read/Write/List/Delete permissions for the tag | ||
| :vartype writeable_properties: :class:`~azure.containerregistry.ContentProperties` | ||
| :vartype writeable_properties: ~azure.containerregistry.ContentProperties | ||
| :ivar created_on: Time the tag was created | ||
| :vartype created_on: :class:`datetime.datetime` | ||
| :vartype created_on: datetime.datetime | ||
| :ivar str digest: Digest for the tag | ||
| :ivar last_updated_on: Time the tag was last updated | ||
| :vartype last_updated_on: :class:`datetime.datetime` | ||
| :vartype last_updated_on: datetime.datetime | ||
| :ivar str name: Name of the image the tag corresponds to | ||
| :ivar str repository: Repository the tag belongs to | ||
| """ | ||
|
|
@@ -218,3 +242,38 @@ def _from_generated(cls, generated, **kwargs): | |
| writeable_properties=generated.writeable_properties, | ||
| repository=kwargs.get("repository", None), | ||
| ) | ||
|
|
||
|
|
||
| class ArtifactArchitecture(str, Enum): | ||
|
|
||
| AMD64 = "amd64" | ||
| ARM = "arm" | ||
| ARM64 = "arm64" | ||
| I386 = "386" | ||
| MIPS = "mips" | ||
| MIPS64 = "mips64" | ||
| MIPS64LE = "mips64le" | ||
| MIPSLE = "mipsle" | ||
| PPC64 = "ppc64" | ||
| PPC64LE = "ppc64le" | ||
| RISCV64 = "riscv64" | ||
| S390X = "s390x" | ||
| WASM = "wasm" | ||
|
|
||
|
|
||
| class ArtifactOperatingSystem(str, Enum): | ||
|
|
||
| AIX = "aix" | ||
| ANDROID = "android" | ||
| DARWIN = "darwin" | ||
| DRAGONFLY = "dragonfly" | ||
| FREEBSD = "freebsd" | ||
| ILLUMOS = "illumos" | ||
| IOS = "ios" | ||
| JS = "js" | ||
| LINUX = "linux" | ||
| NETBSD = "netbsd" | ||
| OPENBSD = "openbsd" | ||
| PLAN9 = "plan9" | ||
| SOLARIS = "solaris" | ||
| WINDOWS = "windows" | ||
Uh oh!
There was an error while loading. Please reload this page.