def get(resource_name, id, opts=None): """ Get the state of an existing `CustomResourceDefinitionList` resource, as identified by `id`. The ID is of the form `[namespace]/[name]`; if `[namespace]` is omitted, then (per Kubernetes convention) the ID becomes `default/[name]`. Pulumi will keep track of this resource using `resource_name` as the Pulumi ID. :param str resource_name: _Unique_ name used to register this resource with Pulumi. :param pulumi.Input[str] id: An ID for the Kubernetes resource to retrieve. Takes the form `[namespace]/[name]` or `[name]`. :param Optional[pulumi.ResourceOptions] opts: A bag of options that control this resource's behavior. """ opts = ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) return CustomResourceDefinitionList(resource_name, opts)
def get(resource_name, api_version, kind, id, opts=None): """ Get the state of an existing `CustomResource` resource, as identified by `id`. Typically this ID is of the form [namespace]/[name]; if [namespace] is omitted, then (per Kubernetes convention) the ID becomes default/[name]. Pulumi will keep track of this resource using `resource_name` as the Pulumi ID. :param str resource_name: _Unique_ name used to register this resource with Pulumi. :param str api_version: The API version of the apiExtensions.CustomResource we wish to select, as specified by the CustomResourceDefinition that defines it on the API server. :param str kind: The kind of the apiextensions.CustomResource we wish to select, as specified by the CustomResourceDefinition that defines it on the API server. :param pulumi.Input[str] id: An ID for the Kubernetes resource to retrieve. Takes the form <namespace>/<name> or <name>. :param Optional[pulumi.ResourceOptions] opts: A bag of options that control this resource's behavior. """ opts = ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) return CustomResource(resource_name=resource_name, api_version=api_version, kind=kind, opts=opts)
def __init__(self, name: str, args: BucketWithNotificationArgs, opts: ResourceOptions = None): super().__init__("unopac:modules:BucketWithNotification", name, {}, opts) log.info( f'Trying to get project default service account for new project with {args.gcp_project}' ) self.bucket = storage.Bucket( args.bucket_resource_name, project=args.gcp_project.project_id, opts=opts, ) gcs_account = storage.get_project_service_account( project=args.gcp_project.project_id, opts=opts.merge(ResourceOptions(depends_on=[args.gcp_project]))) self.topic = pubsub.Topic( f"{args.bucket_resource_name}-{args.topic_resource_name_suffix}", project=args.gcp_project.project_id, opts=opts, ) self.gcs_default_project_service_account_topicbindingtopic_iambinding = ( pubsub.TopicIAMBinding( f"{name}-default-project-service-account-topic-iam-binding", topic=self.topic.id, role="roles/pubsub.publisher", members=[f"serviceAccount:{gcs_account.email_address}"], opts=opts, )) self.pubsub_accountcreator_policy_binding = projects.IAMMember( resource_name= "project-service-account-pubsub-serviceAccount-tokenCreator", project=args.gcp_project.project_id, member=Output.concat( "serviceAccount:service-", args.gcp_project.number, "@gcp-sa-pubsub.iam.gserviceaccount.com", ), role="roles/iam.serviceAccountTokenCreator", ) self.notification = storage.Notification( f"{args.bucket_resource_name}-notification", bucket=self.bucket.name, payload_format="JSON_API_V1", topic=self.topic.id, event_types=[ "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", ], custom_attributes={ "new-attribute": "new-attribute-value", }, opts=opts, )