https://pulumi.com logo
#python
Title
# python
p

prehistoric-beach-79855

11/30/2021, 4:59 PM
Hello all, How can I get properties of a Repository? When I use: ruri=repo.get(resource_name=reponame, id=repoid) The result is: ruri     : {    + arn             : “arnawsecrus east 1xxxx*:repository/my-repo*”    + encryption_configurations  : [    +   [0]: {        + encryption_type: “AES256"       }     ]    + id             : “my-repox”    + image_scanning_configuration: {      + scan_on_push: false     }    + image_tag_mutability    : “MUTABLE”    + name            : “my-repo”    + registry_id         : “xxxxxx”    + repository_url       : “xxxxx.dkr.ecr.us-east-1.amazonaws.com/my-repo-xxxxx”    + urn             : “urnpulumidev:gurney pythonawsecr/repositoryRepository:my-repo” Then I used ruri.apply(lambda r: r[“repository_url”]) but I got this message: TypeError: ‘Repository’ object is not subscriptable So, how should I get the repository_url ?
p

prehistoric-activity-61023

11/30/2021, 6:28 PM
I’m not sure what kind of resource it is but have you tried
r.repository_url
?
Most (all?) properties of pulumi resources are accessed like fields in the class object (
obj.property_name
) and they are not subscriptable (= they do not behave like dict so
obj["property_name"]
won’t work)
s

sparse-state-34229

12/01/2021, 2:32 PM
p

prehistoric-beach-79855

12/01/2021, 6:50 PM
Thank you @prehistoric-activity-61023. Yes, your suggestion works. Actually with that there is no need for using “apply”. I can get it with ruri.repository_url directly.