def update(self, id, _olds, props):
     service = get_service("tagmanager", "v2", SCOPES,
                           props['key_location'])
     workspace = (service.accounts().containers().workspaces().update(
         path=_olds["path"], body={
             "name": props["workspace_name"]
         }).execute())
     return UpdateResult(outs={**props, **workspace})
Example #2
0
    def update(self, id, _olds, props):
        service = get_service("tagmanager", "v2", SCOPES,
                              props['key_location'])
        tag_body = self._get_tag_body(props)
        tag = (service.accounts().containers().workspaces().tags().update(
            path=_olds["path"], body=tag_body).execute())

        return UpdateResult(outs={**props, **tag})
Example #3
0
    def update(self, id, _olds, props):
        service = get_service("tagmanager", "v2", SCOPES,
                              props['key_location'])
        variable_body = self._get_variable_body(props)
        variable = (
            service.accounts().containers().workspaces().variables().update(
                path=_olds["path"], body=variable_body).execute())

        return UpdateResult(outs={
            **props,
            **variable, "variable_id": variable["variableId"]
        })
Example #4
0
 def update(self, id, _olds, props):
     service = get_service("tagmanager", "v2", SCOPES, props['key_location'])
     container = (
         service.accounts()
         .containers()
         .update(
             path=_olds["path"],
             body={"name": props["container_name"], "usage_context": ["web"]},
         )
         .execute()
     )
     return UpdateResult(outs={**props, **container})
Example #5
0
    def update(self, resource_id: str, olds: Any, news: Any) -> UpdateResult:
        """ This update method is called if the diff method return True which means that alias with the specified name
                does not exist and we need to create one for that particular group
                In this method we would be creating a new alias for that group. """

        client.create_alias(
            OrganizationId=news['organization_id'],
            EntityId=news['group_id'],
            Alias=news['alias_email']
        )

        return UpdateResult(
            {'alias_email': news['alias_email'], 'group_id': news['group_id'],
             'message': 'New Alias Created for Group', 'organization_id': news['organization_id']})
Example #6
0
    def update(self, id, _olds, props):
        service = get_service("analytics", "v3", SCOPES, props["key_location"])

        web_property = (
            service.management()
            .webproperties()
            .update(
                accountId=props["account_id"],
                webPropertyId=_olds["tracking_id"],
                body={"websiteUrl": props["site_url"], "name": props["site_url"]},
            )
            .execute()
        )

        return UpdateResult(outs={"tracking_id": web_property["id"], **props})
Example #7
0
    def update(self, _id: str, _olds: Any, _news: Any) -> UpdateResult:

        pulumi.info(
            (
                f"Updating MyResource[{_id}] to "
                f" (param1={_news.get('param1')},param2={_news.get('param2')})..."
            )
        )
        pulumi.info(
            (
                f"Using provider parameters ({self.provider_params.provider_param1},"
                f"{self.provider_params.provider_param2})"
            )
        )

        return UpdateResult(outs={**_news, "output_param": "my_output_value"})
    def update(self, _id: str, _olds: Any, _news: Any) -> UpdateResult:
        """
        Updates existing UserLoginProfile resource

        :param _id:
        :param _olds:
        :param _news:
        :return:
        """

        iam = client("iam", _news)
        username = _olds["username"]
        password = _news["password"]
        login_profile = iam.LoginProfile(user_name=username)
        login_profile.update(Password=password, PasswordResetRequired=True)

        return UpdateResult(outs={**_news, 'password_reset_required': True})
Example #9
0
    def update(self, id, _olds, props):
        service = get_service("tagmanager", "v2", SCOPES,
                              props['key_location'])
        tag_body = {
            "name":
            props["tag_name"],
            "type":
            "ua",
            "parameter": [{
                "key": "trackingId",
                "type": "template",
                "value": str(props["tracking_id"]),
            }],
        }
        tag = (service.accounts().containers().workspaces().tags().update(
            path=_olds["path"], body=tag_body).execute())

        return UpdateResult(outs={**props, **tag})
Example #10
0
    def update(self, resource_id: str, olds: Any, news: Any) -> UpdateResult:
        """ This update method is called if the diff method return True which means that group with the specified name
               does not exist and we need to create one.
               In this method we would be creating a new group for that organization. """

        create_group_response = client.create_group(
            OrganizationId=news['organization_id'], Name=news['group_name'])

        group_id = create_group_response['GroupId']

        register_workmail_response = client.register_to_work_mail(
            OrganizationId=news['organization_id'],
            EntityId=group_id,
            Email=news['group_email'])

        return UpdateResult({
            'group_id': create_group_response['GroupId'],
            'message': 'New Group Created',
            'organization_id': news['organization_id']
        })
Example #11
0
 def update(self, _id: str, _olds: Any, _news: Any) -> UpdateResult:
     print("UPDATE has been called")
     time.sleep(5)
     self._write_content(_news["path"], _news["content"])
     return UpdateResult(outs={**_news})