Coder Social home page Coder Social logo

Comments (5)

Drewm3 avatar Drewm3 commented on June 2, 2024 1

@TravisCragg-MSFT, I am going to assign this one to you for now. Could you please move it over to Kanika once she is setup in GitHub.

from azure-sdk-for-python.

lmazuel avatar lmazuel commented on June 2, 2024 1

get_instance_view returns an instance of VirtualMachineScaleSetVMInstanceView:
https://learn.microsoft.com/en-us/python/api/azure-mgmt-compute/azure.mgmt.compute.v2023_09_01.models.virtualmachinescalesetvminstanceview?view=azure-python

If you print a model, the SDK is trying to show you a preview of the model content, but it doesn't do this recursively (it's just for preview in logs as a string). The current example you show, is actually a result of print(result)

You can access the "statuses" by attribute syntax:

for status in result.statuses:
    print(f"Code: {status.code}, Level: {status.level}, Display: {status.display_status}, Message: {status.message}")

Or convert the entire model recursively to dict, and access what he wants with dict syntax:

dictified_result = result.as_dict()
for status in dictified_result["statuses"]:
    print(" ".join([f"{key}: {value}" for key, value in status.items()]))

Running this code gives something like:

Code: ProvisioningState/succeeded, Level: Info, Display: Provisioning succeeded, Message: None
Code: PowerState/running, Level: Info, Display: VM running, Message: None
code: ProvisioningState/succeeded level: Info display_status: Provisioning succeeded time: 2024-05-16T06:42:02.964781Z
code: PowerState/running level: Info display_status: VM running

Let us knonw if there are more questions!

from azure-sdk-for-python.

github-actions avatar github-actions commented on June 2, 2024

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @amjads1 @avirishuv @Drewm3 @Vaibhav-Agar.

from azure-sdk-for-python.

github-actions avatar github-actions commented on June 2, 2024

Hi @chkp-eddiek. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

from azure-sdk-for-python.

github-actions avatar github-actions commented on June 2, 2024

Hi @chkp-eddiek, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

from azure-sdk-for-python.

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.