Beispiel #1
0
    def _Create(self, args, var_resource, value):
        variable_client = util.VariableClient()
        messages = util.Messages()

        project = var_resource.projectsId
        config = var_resource.configsId
        name = var_resource.Name()

        result = variable_client.Create(
            messages.RuntimeconfigProjectsConfigsVariablesCreateRequest(
                projectsId=project,
                configsId=config,
                variable=messages.Variable(name=util.VariablePath(
                    project, config, name),
                                           value=value)))

        log.CreatedResource(var_resource)
        return util.FormatVariable(result)
Beispiel #2
0
    def _Update(self, args, var_resource, value):
        variable_client = util.VariableClient()
        messages = util.Messages()

        project = var_resource.projectsId
        config = var_resource.configsId
        name = var_resource.Name()

        result = variable_client.Update(
            messages.RuntimeconfigProjectsConfigsVariablesUpdateRequest(
                projectsId=project,
                configsId=config,
                variablesId=name,
                variable=messages.Variable(
                    name=util.VariablePath(project, config, name),
                    value=value if not args.is_text else None,
                    text=value if args.is_text else None,
                )))

        log.UpdatedResource(var_resource)
        return util.FormatVariable(result)