Updates a storage policy.

    profile_manager
        Reference to the profile manager.

    policy
        Reference to the policy to be updated.

    policy_spec
        Policy update spec.
480166
def update_storage_policy(profile_manager, policy, policy_spec):
    '''
    
    '''
    try:
        profile_manager.Update(policy.profileId, policy_spec)
    except vim.fault.NoPermission as exc:
        log.exception(exc)
        raise VMwareApiError('Not enough permissions. Required privilege: '
                             '{0}'.format(exc.privilegeId))
    except vim.fault.VimFault as exc:
        log.exception(exc)
        raise VMwareApiError(exc.msg)
    except vmodl.RuntimeFault as exc:
        log.exception(exc)
        raise VMwareRuntimeError(exc.msg)
624049
def update_firewall_policy(self, firewall_policy, body=None):
        """"""
        return self.put(self.firewall_policy_path % (firewall_policy),
                        body=body)
313566
def update(name, launch_config_name, availability_zones, min_size, max_size,
           desired_capacity=None, load_balancers=None, default_cooldown=None,
           health_check_type=None, health_check_period=None,
           placement_group=None, vpc_zone_identifier=None, tags=None,
           termination_policies=None, suspended_processes=None,
           scaling_policies=None, scheduled_actions=None,
           notification_arn=None, notification_types=None,
           region=None, key=None, keyid=None, profile=None):
    '''
    
    '''

    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    conn3 = _get_conn_autoscaling_boto3(region=region, key=key, keyid=keyid,
                                        profile=profile)
    if not conn:
        return False, "failed to connect to AWS"
    if isinstance(availability_zones, six.string_types):
        availability_zones = salt.utils.json.loads(availability_zones)
    if isinstance(load_balancers, six.string_types):
        load_balancers = salt.utils.json.loads(load_balancers)
    if isinstance(vpc_zone_identifier, six.string_types):
        vpc_zone_identifier = salt.utils.json.loads(vpc_zone_identifier)
    if isinstance(tags, six.string_types):
        tags = salt.utils.json.loads(tags)
    if isinstance(termination_policies, six.string_types):
        termination_policies = salt.utils.json.loads(termination_policies)
    if isinstance(suspended_processes, six.string_types):
        suspended_processes = salt.utils.json.loads(suspended_processes)
    if isinstance(scheduled_actions, six.string_types):
        scheduled_actions = salt.utils.json.loads(scheduled_actions)

    # Massage our tagset into  add / remove lists
    # Use a boto3 call here b/c the boto2 call doeesn't implement filters
    current_tags = conn3.describe_tags(Filters=[{'Name': 'auto-scaling-group',
                                      'Values': [name]}]).get('Tags', [])
    current_tags = [{'key': t['Key'],
                     'value': t['Value'],
                     'resource_id': t['ResourceId'],
                     'propagate_at_launch': t.get('PropagateAtLaunch', False)}
                          for t in current_tags]
    add_tags = []
    desired_tags = []
    if tags:
        tags = __utils__['boto3.ordered'](tags)
        for tag in tags:
            try:
                key = tag.get('key')
            except KeyError:
                log.error('Tag missing key.')
                return False, "Tag {0} missing key".format(tag)
            try:
                value = tag.get('value')
            except KeyError:
                log.error('Tag missing value.')
                return False, "Tag {0} missing value".format(tag)
            propagate_at_launch = tag.get('propagate_at_launch', False)
            _tag = {'key': key,
                    'value': value,
                    'resource_id': name,
                    'propagate_at_launch': propagate_at_launch}
            if _tag not in current_tags:
                add_tags.append(_tag)
            desired_tags.append(_tag)
    delete_tags = [t for t in current_tags if t not in desired_tags]

    retries = 30
    while True:
        try:
            _asg = autoscale.AutoScalingGroup(
                connection=conn,
                name=name, launch_config=launch_config_name,
                availability_zones=availability_zones,
                min_size=min_size, max_size=max_size,
                desired_capacity=desired_capacity, load_balancers=load_balancers,
                default_cooldown=default_cooldown,
                health_check_type=health_check_type,
                health_check_period=health_check_period,
                placement_group=placement_group, tags=add_tags,
                vpc_zone_identifier=vpc_zone_identifier,
                termination_policies=termination_policies)
            if notification_arn and notification_types:
                conn.put_notification_configuration(_asg, notification_arn, notification_types)
            _asg.update()
            # Seems the update call doesn't handle tags, so we'll need to update
            # that separately.
            if add_tags:
                log.debug('Adding/updating tags from ASG: %s', add_tags)
                conn.create_or_update_tags([autoscale.Tag(**t) for t in add_tags])
            if delete_tags:
                log.debug('Deleting tags from ASG: %s', delete_tags)
                conn.delete_tags([autoscale.Tag(**t) for t in delete_tags])
            # update doesn't handle suspended_processes either
            # Resume all processes
            _asg.resume_processes()
            # suspend any that are specified.  Note that the boto default of empty
            # list suspends all; don't do that.
            if suspended_processes:
                _asg.suspend_processes(suspended_processes)
            log.info('Updated ASG %s', name)
            # ### scaling policies
            # delete all policies, then recreate them
            for policy in conn.get_all_policies(as_group=name):
                conn.delete_policy(policy.name, autoscale_group=name)
            _create_scaling_policies(conn, name, scaling_policies)
            # ### scheduled actions
            # delete all scheduled actions, then recreate them
            for scheduled_action in conn.get_all_scheduled_actions(as_group=name):
                conn.delete_scheduled_action(
                    scheduled_action.name, autoscale_group=name
                )
            _create_scheduled_actions(conn, name, scheduled_actions)
            return True, ''
        except boto.exception.BotoServerError as e:
            if retries and e.code == 'Throttling':
                log.debug('Throttled by AWS API, retrying in 5 seconds...')
                time.sleep(5)
                retries -= 1
                continue
            log.error(e)
            msg = 'Failed to update ASG {0}'.format(name)
            log.error(msg)
            return False, six.text_type(e)
1316711
private void updateLocalProfileKeyExpiryTime(String key) {
        if (key == null) return;

        synchronized (PROFILE_EXPIRY_MAP) {
            PROFILE_EXPIRY_MAP.put(key, calculateLocalKeyExpiryTime());
        }
    }
167818
private void updatePrincipal() {

        principal = new JsonObject();
        profiles.forEach((name, profile) -> {
            final JsonObject jsonProfile = new JsonObject();
            profile.getAttributes()
                    .forEach((attributeName, attributeValue) ->
                            jsonProfile.put(attributeName, attributeValue.toString()));
            principal.put(name, jsonProfile);
        });
    }
592135
def replace_policy(self, scaling_group, policy, name,
            policy_type, cooldown, change=None, is_percent=False,
            desired_capacity=None, args=None):
        
        policy_id = utils.get_id(policy)
        group_id = utils.get_id(scaling_group)
        uri = "/%s/%s/policies/%s" % (self.uri_base, group_id, policy_id)
        body = self._create_policy_body(name=name, policy_type=policy_type,
                cooldown=cooldown, change=change, is_percent=is_percent,
                desired_capacity=desired_capacity, args=args)
        resp, resp_body = self.api.method_put(uri, body=body)
16422
def profile_view(name, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('profile:view', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
    })
249341
def execute_policy(self, policy):
        
        return self.manager.execute_policy(scaling_group=self, policy=policy)
241813
def update_profile(self, attrs, attr_map=None):
        
        user_attrs = dict_to_cognito(attrs,attr_map)
        self.client.update_user_attributes(
            UserAttributes=user_attrs,
            AccessToken=self.access_token
        )
1331125
def _get_policy_dict(policy):
    ''''''
    profile_dict = {'name': policy.name,
                    'description': policy.description,
                    'resource_type': policy.resourceType.resourceType}
    subprofile_dicts = []
    if isinstance(policy, pbm.profile.CapabilityBasedProfile) and \
       isinstance(policy.constraints,
                  pbm.profile.SubProfileCapabilityConstraints):

        for subprofile in policy.constraints.subProfiles:
            subprofile_dict = {'name': subprofile.name,
                               'force_provision': subprofile.forceProvision}
            cap_dicts = []
            for cap in subprofile.capability:
                cap_dict = {'namespace': cap.id.namespace,
                            'id': cap.id.id}
                # We assume there is one constraint with one value set
                val = cap.constraint[0].propertyInstance[0].value
                if isinstance(val, pbm.capability.types.Range):
                    val_dict = {'type': 'range',
                                'min': val.min,
                                'max': val.max}
                elif isinstance(val, pbm.capability.types.DiscreteSet):
                    val_dict = {'type': 'set',
                                'values': val.values}
                else:
                    val_dict = {'type': 'scalar',
                                'value': val}
                cap_dict['setting'] = val_dict
                cap_dicts.append(cap_dict)
            subprofile_dict['capabilities'] = cap_dicts
            subprofile_dicts.append(subprofile_dict)
    profile_dict['subprofiles'] = subprofile_dicts
    return profile_dict
961174
def update_webhook_metadata(self, policy, webhook, metadata):
        
        return self.manager.update_webhook_metadata(self, policy, webhook,
                metadata)
1179206
public static base_response update(nitro_service client, transformpolicy resource) throws Exception {
		transformpolicy updateresource = new transformpolicy();
		updateresource.name = resource.name;
		updateresource.rule = resource.rule;
		updateresource.profilename = resource.profilename;
		updateresource.comment = resource.comment;
		updateresource.logaction = resource.logaction;
		return updateresource.update_resource(client);
	}
766820
private void updateFederatedManagerService() {
        if (!activated) {
            return;
        }

        if (profileManager.getReference() != null) {
            Tr.info(tc, "FEDERATED_MANAGER_SERVICE_READY");
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Some required federated manager services are not available.");
            }
        }
    }
1257226
def update_service_profile(self, service_profile, body):
        """"""
        return self.put(self.service_profile_path % (service_profile),
                        body=body)
983410
def update(self, ignore_warnings=None):
        
        update_mask_pb = field_mask_pb2.FieldMask()

        if self.description is not None:
            update_mask_pb.paths.append("description")

        if self.routing_policy_type == RoutingPolicyType.ANY:
            update_mask_pb.paths.append("multi_cluster_routing_use_any")
        else:
            update_mask_pb.paths.append("single_cluster_routing")

        return self.instance_admin_client.update_app_profile(
            app_profile=self._to_pb(),
            update_mask=update_mask_pb,
            ignore_warnings=ignore_warnings,
        )
147854
def update_assume_role_policy(role_name, policy_document, region=None,
                              key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if isinstance(policy_document, six.string_types):
        policy_document = salt.utils.json.loads(policy_document,
                                     object_pairs_hook=odict.OrderedDict)
    try:
        _policy_document = salt.utils.json.dumps(policy_document)
        conn.update_assume_role_policy(role_name, _policy_document)
        log.info('Successfully updated assume role policy for IAM role %s.', role_name)
        return True
    except boto.exception.BotoServerError as e:
        log.error(e)
        log.error('Failed to update assume role policy for IAM role %s.', role_name)
        return False
981016
def update_account_password_policy(allow_users_to_change_password=None,
                                   hard_expiry=None, max_password_age=None,
                                   minimum_password_length=None,
                                   password_reuse_prevention=None,
                                   require_lowercase_characters=None,
                                   require_numbers=None, require_symbols=None,
                                   require_uppercase_characters=None,
                                   region=None, key=None, keyid=None,
                                   profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    try:
        conn.update_account_password_policy(allow_users_to_change_password,
                                            hard_expiry, max_password_age,
                                            minimum_password_length,
                                            password_reuse_prevention,
                                            require_lowercase_characters,
                                            require_numbers, require_symbols,
                                            require_uppercase_characters)
        log.info('The password policy has been updated.')
        return True
    except boto.exception.BotoServerError as e:
        log.debug(e)
        msg = 'Failed to update the password policy'
        log.error(msg)
        return False