Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove cl graph lookup + add Instances get_resource_map() #301

Merged
merged 7 commits into from
Aug 8, 2024

Conversation

digimaun
Copy link
Member

@digimaun digimaun commented Aug 8, 2024

  • Eliminate usage of resource graph for fetching custom location associated with instance.

  • Provide useful public method on Instances, get_resource_map.

    Example:

    instances = Instances(cmd)
    myinstance = instances.show(name=instance_name, resource_group_name=resource_group_name)
    resource_map = instances.get_resource_map(myinstance)
    
    # Check if connected cluster is online
    assert resource_map.connected_cluster.connected

@digimaun digimaun marked this pull request as ready for review August 8, 2024 19:17
def get_associated_cl(self, instance: dict) -> dict:
return self.query(
QUERIES["get_cl_from_instance"].format(resource_id=instance["extendedLocation"]["name"]), first=True
def _get_associated_cl(self, instance: dict) -> dict:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this should be abstracted since the assets also need the custom location...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless you expect us to create an instance of this class for assets/other rpsaas services

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by this ? The instance has reference to the custom location Id. What do you need from the custom location to create an asset ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need the custom location id (for the extended location) + all the cluster + custom location checks for asset/endpoint creation...

@vilit1 vilit1 merged commit 0528703 into Azure:dev Aug 8, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants