Created
March 13, 2020 06:17
-
-
Save lucassrg/9fd0fb191a3fb519872a9498580213af to your computer and use it in GitHub Desktop.
Marketplace App Catalog Subscription
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
# coding: utf-8 | |
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. | |
# This script subscribes to a Marketplace listing by accepting all terms and conditions and list all subscriptions | |
# | |
# | |
# | |
import oci | |
compartment_id = "ocid1.compartment." | |
listing_ocid = "ocid1.appcataloglisting.oc1." | |
listing_resource_version = "XYZ" | |
config = oci.config.from_file('./oci_config') | |
compc = oci.core.ComputeClient(config, retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY) | |
#clean-up existing subscriptions | |
# print(compc.delete_app_catalog_subscription(listing_ocid, compartment_id, listing_resource_version).data) | |
#AppCatalogListingResourceVersionAgreements | |
agreements = compc.get_app_catalog_listing_agreements(listing_ocid, listing_resource_version).data | |
print("#create agreements") | |
print(agreements) | |
appCatalogSubscriptionDetails = oci.core.models.CreateAppCatalogSubscriptionDetails() | |
appCatalogSubscriptionDetails.compartment_id = compartment_id | |
appCatalogSubscriptionDetails.eula_link = agreements.eula_link | |
appCatalogSubscriptionDetails.listing_id = agreements.listing_id | |
appCatalogSubscriptionDetails.listing_resource_version = agreements.listing_resource_version | |
appCatalogSubscriptionDetails.oracle_terms_of_use_link = agreements.oracle_terms_of_use_link | |
appCatalogSubscriptionDetails.signature = agreements.signature | |
appCatalogSubscriptionDetails.time_retrieved = agreements.time_retrieved | |
print("#accept_agreements") | |
print(appCatalogSubscriptionDetails) | |
#oci.core.models.AppCatalogSubscription | |
subscription = compc.create_app_catalog_subscription(appCatalogSubscriptionDetails).data | |
print("#show subscription") | |
print(subscription) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment