-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring surface area at par with .Net and fix digest computation perfor…
…mance. (#27503) * Bring surface area at part with .Net and fix follow up bugs. * Incorporate feedback.
- Loading branch information
Showing
8 changed files
with
219 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
.../src/main/java/com/azure/containers/containerregistry/models/DownloadManifestOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.containers.containerregistry.models; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Options for configuring the download manifest operation. | ||
*/ | ||
public final class DownloadManifestOptions { | ||
private final String tag; | ||
private final String digest; | ||
|
||
private DownloadManifestOptions(String tag, String digest) { | ||
this.tag = tag; | ||
this.digest = digest; | ||
} | ||
|
||
/** | ||
* Instantiate the options class with tag. | ||
* @param tag The tag associated with the manifest. | ||
* @return The DownloadManifestOptions object. | ||
*/ | ||
public static DownloadManifestOptions fromTag(String tag) { | ||
Objects.requireNonNull(tag, "tag can't be null"); | ||
return new DownloadManifestOptions(tag, null); | ||
} | ||
|
||
/** | ||
* Instantiate the options class with tag. | ||
* @param digest The digest associated with the manifest. | ||
* @return The DownloadManifestOptions object. | ||
*/ | ||
public static DownloadManifestOptions fromDigest(String digest) { | ||
Objects.requireNonNull(digest, "digest can't be null"); | ||
return new DownloadManifestOptions(null, digest); | ||
} | ||
|
||
/** | ||
* Digest identifier of the manifest. | ||
* @return The associated digest. | ||
*/ | ||
public String getDigest() { | ||
return this.digest; | ||
} | ||
|
||
/** | ||
* Tag identifier of the manifest. | ||
* @return The associated tag. | ||
*/ | ||
public String getTag() { | ||
return this.tag; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...y/src/main/java/com/azure/containers/containerregistry/models/DownloadManifestResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
package com.azure.containers.containerregistry.models; | ||
|
||
import com.azure.core.util.BinaryData; | ||
|
||
/** | ||
* The result from downloading an OCI manifest from the registry. | ||
*/ | ||
public class DownloadManifestResult { | ||
private final String digest; | ||
private final OciManifest manifest; | ||
private final BinaryData manifestStream; | ||
|
||
/** | ||
* Instantiate an instance of the DownloadManifestResult object. | ||
* @param digest The digest of the manifest. | ||
* @param manifest The OCIManifest object. | ||
* @param manifestStream The manifest stream. | ||
*/ | ||
public DownloadManifestResult(String digest, OciManifest manifest, BinaryData manifestStream) { | ||
this.digest = digest; | ||
this.manifest = manifest; | ||
this.manifestStream = manifestStream; | ||
} | ||
|
||
/** | ||
* The manifest's digest, calculated by the registry. | ||
* @return The digest. | ||
*/ | ||
public String getDigest() { | ||
return this.digest; | ||
} | ||
|
||
/** | ||
* The OCI manifest that was downloaded. | ||
* @return The OCIManifest object. | ||
*/ | ||
public OciManifest getManifest() { | ||
return this.manifest; | ||
} | ||
|
||
/** | ||
* The manifest stream that was downloaded. | ||
* @return The associated manifest stream. | ||
*/ | ||
public BinaryData getManifestStream() { | ||
return this.manifestStream; | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...ry/src/main/java/com/azure/containers/containerregistry/models/UploadManifestOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.containers.containerregistry.models; | ||
|
||
import com.azure.core.util.BinaryData; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Options for configuring the upload manifest operation. | ||
*/ | ||
public final class UploadManifestOptions { | ||
private String tag; | ||
private final BinaryData manifest; | ||
|
||
/** | ||
* Instantiate an instance of upload manifest options with the manifest information. | ||
* @param manifest The manifest that needs to be uploaded. | ||
*/ | ||
public UploadManifestOptions(BinaryData manifest) { | ||
Objects.requireNonNull(manifest, "'manifest' can't be null."); | ||
this.manifest = manifest; | ||
} | ||
|
||
/** | ||
* Instantiate an instance of upload manifest options with the ocimanifest information. | ||
* @param ociManifest The Oci manifest. | ||
*/ | ||
public UploadManifestOptions(OciManifest ociManifest) { | ||
Objects.requireNonNull(ociManifest, "'ociManifest' can't be null."); | ||
this.manifest = BinaryData.fromObject(ociManifest); | ||
} | ||
|
||
/** | ||
* A tag to assign to the artifact represented by this manifest. | ||
* @param tag The tag of the manifest. | ||
* @return The UploadManifestOptions object. | ||
*/ | ||
public UploadManifestOptions setTag(String tag) { | ||
this.tag = tag; | ||
return this; | ||
} | ||
|
||
/** | ||
* The tag assigned to the artifact represented by this manifest. | ||
* @return The tag of the manifest. | ||
*/ | ||
public String getTag() { | ||
return this.tag; | ||
} | ||
|
||
/** | ||
* The manifest to be uploaded. | ||
* @return The BinaryData representing the manifest. | ||
*/ | ||
public BinaryData getManifest() { | ||
return this.manifest; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.