|
4 | 4 |
|
5 | 5 | // Artifacts and Container Images API |
6 | 6 | // |
7 | | -// API covering the Artifacts and Registry (https://docs.oracle.com/iaas/Content/Registry/Concepts/registryoverview.htm) services. |
8 | | -// Use this API to manage resources such as generic artifacts and container images. |
| 7 | +// Use the Artifacts and Container Images API to manage container images and non-container generic artifacts. |
| 8 | +// - For container images such as Docker images, use the ContainerImage resource. Save the images in a ContainerRepository. |
| 9 | +// - For non-container generic artifacts or blobs, use the GenericArtifact resource. Save the artifacts in an Repository. |
| 10 | +// - To upload and download non-container generic artifacts, instead of the Artifacts and Container Images API, use the Generic Artifacts Content API. |
| 11 | +// For more information, see the user guides for Container Registry (https://docs.oracle.com/iaas/Content/Registry/home.htm) and Artifact Registry (https://docs.oracle.com/iaas/Content/artifacts/home.htm). |
9 | 12 | // |
10 | 13 |
|
11 | 14 | package artifacts |
@@ -1454,6 +1457,64 @@ func (client ArtifactsClient) listRepositories(ctx context.Context, request comm |
1454 | 1457 | return response, err |
1455 | 1458 | } |
1456 | 1459 |
|
| 1460 | +// LookupContainerImageByUri Get container image metadata by URI. |
| 1461 | +// |
| 1462 | +// # See also |
| 1463 | +// |
| 1464 | +// Click https://docs.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/artifacts/LookupContainerImageByUri.go.html to see an example of how to use LookupContainerImageByUri API. |
| 1465 | +// A default retry strategy applies to this operation LookupContainerImageByUri() |
| 1466 | +func (client ArtifactsClient) LookupContainerImageByUri(ctx context.Context, request LookupContainerImageByUriRequest) (response LookupContainerImageByUriResponse, err error) { |
| 1467 | + var ociResponse common.OCIResponse |
| 1468 | + policy := common.DefaultRetryPolicy() |
| 1469 | + if client.RetryPolicy() != nil { |
| 1470 | + policy = *client.RetryPolicy() |
| 1471 | + } |
| 1472 | + if request.RetryPolicy() != nil { |
| 1473 | + policy = *request.RetryPolicy() |
| 1474 | + } |
| 1475 | + ociResponse, err = common.Retry(ctx, request, client.lookupContainerImageByUri, policy) |
| 1476 | + if err != nil { |
| 1477 | + if ociResponse != nil { |
| 1478 | + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { |
| 1479 | + opcRequestId := httpResponse.Header.Get("opc-request-id") |
| 1480 | + response = LookupContainerImageByUriResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} |
| 1481 | + } else { |
| 1482 | + response = LookupContainerImageByUriResponse{} |
| 1483 | + } |
| 1484 | + } |
| 1485 | + return |
| 1486 | + } |
| 1487 | + if convertedResponse, ok := ociResponse.(LookupContainerImageByUriResponse); ok { |
| 1488 | + response = convertedResponse |
| 1489 | + } else { |
| 1490 | + err = fmt.Errorf("failed to convert OCIResponse into LookupContainerImageByUriResponse") |
| 1491 | + } |
| 1492 | + return |
| 1493 | +} |
| 1494 | + |
| 1495 | +// lookupContainerImageByUri implements the OCIOperation interface (enables retrying operations) |
| 1496 | +func (client ArtifactsClient) lookupContainerImageByUri(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { |
| 1497 | + |
| 1498 | + httpRequest, err := request.HTTPRequest(http.MethodPost, "/container/images/actions/lookupImageByUri", binaryReqBody, extraHeaders) |
| 1499 | + if err != nil { |
| 1500 | + return nil, err |
| 1501 | + } |
| 1502 | + |
| 1503 | + var response LookupContainerImageByUriResponse |
| 1504 | + var httpResponse *http.Response |
| 1505 | + httpResponse, err = client.Call(ctx, &httpRequest) |
| 1506 | + defer common.CloseBodyIfValid(httpResponse) |
| 1507 | + response.RawResponse = httpResponse |
| 1508 | + if err != nil { |
| 1509 | + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/registry/20160918/ContainerImage/LookupContainerImageByUri" |
| 1510 | + err = common.PostProcessServiceError(err, "Artifacts", "LookupContainerImageByUri", apiReferenceLink) |
| 1511 | + return response, err |
| 1512 | + } |
| 1513 | + |
| 1514 | + err = common.UnmarshalResponse(httpResponse, &response) |
| 1515 | + return response, err |
| 1516 | +} |
| 1517 | + |
1457 | 1518 | // RemoveContainerVersion Remove version from container image. |
1458 | 1519 | // |
1459 | 1520 | // # See also |
|
0 commit comments