Giter Site home page Giter Site logo

Comments (8)

Gopichand-Heeddata avatar Gopichand-Heeddata commented on September 17, 2024

@adizohar Could you please help me on this issue.

from oci-python-sdk.

adizohar avatar adizohar commented on September 17, 2024

Please run the below in order to compare
It could be you have additional filter on the console

import oci

# Load configuration from the default OCI config file
config = oci.config.from_file()

# Initialize the OptimizerClient
optimizer_client = oci.optimizer.OptimizerClient(config)

# Get the compartment ID from the config file
compartment_id = config['tenancy']
compartment_id_in_subtree = True

# List recommendations
list_recommendations_response = oci.pagination.list_call_get_all_results(
    optimizer_client.list_recommendations,
    compartment_id=compartment_id,
    compartment_id_in_subtree=compartment_id_in_subtree
)

# Iterate over each recommendation
for recommendation in list_recommendations_response.data:
    # Print recommendation details (optional)
    if recommendation.name != "cost-management-compute-enable-monitoring-name":
        continue

    # List resource actions for the recommendation
    list_resource_actions_response = oci.pagination.list_call_get_all_results(
        optimizer_client.list_resource_actions,
        recommendation_id=recommendation.id,
        compartment_id=compartment_id,
        compartment_id_in_subtree=compartment_id_in_subtree,
        sort_by='TIMECREATED',
    )

    # Iterate over each resource action
    for resource_action in list_resource_actions_response.data:
        rext = resource_action.extended_metadata
        print(rext['resourceOwningTenancyName'] + " - " + rext['region'] + " - " + resource_action.resource_id)

from oci-python-sdk.

Gopichand-Heeddata avatar Gopichand-Heeddata commented on September 17, 2024

@adizohar After running this code also am still getting extra resources cost-management-compute-enable-monitoring-name. My OCI console only has 7 but API fetches 8 records.
image000

API response:

  • -ap-hyderabad-1 - ocid1.instance.oc1.ap-hyderabad-1.anuhsljr7zexxxxxxxxxxxxxqb4ksdfjx7czo4icya
  • -ap-hyderabad-1 - ocid1.instance.oc1.ap-hyderabad-1.anuhsljrypiaxxxxxxxxxxxxxxe3f2rcckyeixmse5ua2ba
    • ap-mumbai-1 - ocid1.instance.oc1.ap-mumbai-1.anrg6ljr7qgdflycobmxxxxxxxxxxxxxxh333qmu7vpn7vq
    • ap-hyderabad-1 - ocid1.instance.oc1.ap-hyderabad-1.anuhsljr7qxxxxxxxxxxxxxgdflshrv7npzi4d6li7pq
    • ap-mumbai-1 - ocid1.instance.oc1.ap-mumbai-1.anrg6ljr7qgdflycxxxxxxxxxxxxxxxxx4q4wzi37tunv2bcggq
    • ap-mumbai-1 - ocid1.instance.oc1.ap-mumbai-1.anrg6ljr7qgdflyxxxxxxxxxxxxxxcumym35nzurcysq
    • ap-mumbai-1 - ocid1.instance.oc1.ap-mumbai-1.anrg6ljr7qgdflyxxxxxxxxxxxau477rdye2hfi6pasrq
    • ap-mumbai-1 - ocid1.instance.oc1.ap-mumbai-1.anrg6ljr7qgdflycxxxxxxxxxxytvqxlul7rwd6btzxja

from oci-python-sdk.

adizohar avatar adizohar commented on September 17, 2024

Gopi

I don’t see any issue with OCI SDK
This issue should go to Oracle support

Please open Oracle support ticket and the support will investigate and will redirect it to the console team.

Because it is not OCI SDK issue please kindly close this issue

Thank you

from oci-python-sdk.

Gopichand-Heeddata avatar Gopichand-Heeddata commented on September 17, 2024

@adizohar I have one question :

  1. is there any time span between the cloud console and API?

from oci-python-sdk.

adizohar avatar adizohar commented on September 17, 2024

No, The console uses the same APIs

from oci-python-sdk.

Gopichand-Heeddata avatar Gopichand-Heeddata commented on September 17, 2024

Thank you adizohar

from oci-python-sdk.

Gopichand-Heeddata avatar Gopichand-Heeddata commented on September 17, 2024

Thankyou for your support @adizohar

from oci-python-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.