Build the Public Network ACL

@param {Number} numZones Number of availability zones
15170
function buildPublicNetworkAcl(numZones = 0) {
  if (numZones < 1) {
    return {};
  }

  const resources = {};

  Object.assign(
    resources,
    buildNetworkAcl(PUBLIC_SUBNET),
    buildNetworkAclEntry(`${PUBLIC_SUBNET}NetworkAcl`, '0.0.0.0/0'),
    buildNetworkAclEntry(`${PUBLIC_SUBNET}NetworkAcl`, '0.0.0.0/0', {
      Egress: true,
    }),
  );

  for (let i = 1; i <= numZones; i += 1) {
    Object.assign(resources, buildNetworkAclAssociation(PUBLIC_SUBNET, i));
  }

  return resources;
}
1027192
public Acl applyAcl(final String repositoryId, final String objectId, final Acl acl, final AclPropagation aclPropagation) {

		final App app = StructrApp.getInstance(securityContext);

		try (final Tx tx = app.tx()) {

			final AbstractNode node = app.get(AbstractNode.class, objectId);
			if (node != null) {

				node.revokeAll();

				// process add ACL entries
				for (final Ace toAdd : acl.getAces()) {
					applyAce(node, toAdd, false);
				}

				tx.success();

				// return the wrapper which implements the Acl interface
				return CMISObjectWrapper.wrap(node, null, false);
			}

		} catch (FrameworkException fex) {
			logger.warn("", fex);
		}

		throw new CmisObjectNotFoundException("Object with ID " + objectId + " does not exist");
	}
1091476
def network_acl_exists(network_acl_id=None, name=None, network_acl_name=None,
                       tags=None, region=None, key=None, keyid=None,
                       profile=None):
    '''
    
    '''

    if name:
        log.warning('boto_vpc.network_acl_exists: name parameter is deprecated '
                    'use network_acl_name instead.')
        network_acl_name = name

    return resource_exists('network_acl', name=network_acl_name,
                           resource_id=network_acl_id, tags=tags,
                           region=region, key=key, keyid=keyid,
                           profile=profile)
635146
function (key, intervalSize, limit) {
        var deferred = Q.defer()
            , memcached = Shared.memcached();
        if (!memcached) {
            deferred.reject();
        }
        else {
            //Get current rate for ip
            memcached.get(key, function (err, value) {
                if (err) {
                    //Allow access as failover
                    Logger.warn("Rate limit set but memcached error, allow access without limit", err);
                    deferred.reject();
                }
                else if (_.isUndefined(value)) {
                    memcached.set(key, 1, 60 * intervalSize, function (err) {
                        if (err) {
                            Logger.warn("Rate limit set but memcached error, allow access without limit", err);
                        }
                    });
                    deferred.resolve(1);
                }
                else {
                    //Do not increase rate counter if exceeded anyway
                    if (value < limit) {
                        // Increase rate counter by 1
                        memcached.incr(key, 1, function (err) {
                            if (err) {
                                Logger.warn("Rate limit set but memcached error, allow access without limit", err);
                            }
                        });
                    }
                    deferred.resolve(value + 1);
                }
            });
        }
        return deferred.promise;
    }
381065
function buildSubnet(name, position, zone, cidrBlock) {
  const cfName = `${name}Subnet${position}`;
  return {
    [cfName]: {
      Type: 'AWS::EC2::Subnet',
      Properties: {
        AvailabilityZone: zone,
        CidrBlock: cidrBlock,
        Tags: [
          {
            Key: 'Name',
            Value: {
              'Fn::Join': [
                '-',
                [
                  {
                    Ref: 'AWS::StackName',
                  },
                  name.toLowerCase(),
                  zone,
                ],
              ],
            },
          },
        ],
        VpcId: {
          Ref: 'VPC',
        },
      },
    },
  };
}
797646
private String createNonSequential(String path, byte[] data, List<ACL> acl, CreateMode createMode)
      throws KeeperException, InterruptedException {
    RetryCounter retryCounter = retryCounterFactory.create();
    while (true) {
      try {
        return zk.create(path, data, acl, createMode);
      } catch (KeeperException e) {
        switch (e.code()) {
          case NODEEXISTS:
            // Non-sequential node was successfully created
            return path;

          case CONNECTIONLOSS:
          case OPERATIONTIMEOUT:
            LOG.warn("Possibly transient ZooKeeper exception: " + e);
            if (!retryCounter.shouldRetry()) {
              LOG.error("ZooKeeper create failed after "
                  + retryCounter.getMaxRetries() + " retries");
              throw e;
            }
            break;

          default:
            throw e;
        }
      }
      LOG.info("Retrying ZooKeeper after sleeping...");
      retryCounter.sleepUntilNextRetry();
      retryCounter.useRetry();
    }
  }
213203
function ZNV2Swarm (opt, protocol, zeronet, lp2p) {
  const self = this
  self.proto = self.protocol = new ZProtocol({
    crypto: opt.crypto,
    id: opt.id
  }, zeronet)

  log('creating zeronet swarm')

  const tr = self.transport = {}
  self.multiaddrs = (opt.listen || []).map(m => multiaddr(m));

  (opt.transports || []).forEach(transport => {
    tr[transport.tag || transport.constructor.name] = transport
    if (!transport.listeners) {
      transport.listeners = []
    }
  })

  TRANSPORT(self)
  DIAL(self, lp2p)

  self.advertise = {
    ip: null,
    port: null,
    port_open: null
  }

  let nat
  if (opt.nat) nat = self.nat = new NAT(self, opt)

  self.start = cb => series([
    self.listen,
    nat ? nat.doDefault : cb => cb()
  ], cb)

  self.stop = cb => series([
    self.unlisten
  ], cb)
}
93731
static private boolean isInlineLimitPlanNodePossible(AbstractPlanNode pn) {
        if (pn instanceof OrderByPlanNode ||
            pn.getPlanNodeType() == PlanNodeType.AGGREGATE) {
            return true;
        }
        return false;
    }
968491
function (opts) {
    opts = opts || {};
    this.name = opts.name || 'unknown';
    this.userId = opts.userId;
    this.userRole = opts.userRole || 'anonymous';
    this.acl = opts.acl || {};
    this.permissions = opts.permissions || [];
}
1356983
function buildRouteTable(name, position, zone) {
  const cfName = `${name}RouteTable${position}`;
  return {
    [cfName]: {
      Type: 'AWS::EC2::RouteTable',
      Properties: {
        VpcId: {
          Ref: 'VPC',
        },
        Tags: [
          {
            Key: 'Name',
            Value: {
              'Fn::Join': [
                '-',
                [
                  {
                    Ref: 'AWS::StackName',
                  },
                  name.toLowerCase(),
                  zone,
                ],
              ],
            },
          },
        ],
      },
    },
  };
}
1028511
def setup(self):
        self.client = self._get_client()
        sg = self._create_isolation_security_group()
        if self.exists is not True:
            acl = self._create_network_acl()
            self._add_network_acl_entries(acl)
            self._add_security_group_rule(sg)
        self._add_security_group_to_instance(sg)

        """"""
        if self.dry_run is not False:
            self._add_security_group_rule(sg)
            self._add_security_group_to_instance(sg)
733562
public function putObjectAcl($bucket, $object, $acl)
    {
        $this->precheckCommon($bucket, $object, $options, true);
        $options[self::OSS_BUCKET] = $bucket;
        $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
        $options[self::OSS_OBJECT] = $object;
        $options[self::OSS_HEADERS] = array(self::OSS_OBJECT_ACL => $acl);
        $options[self::OSS_SUB_RESOURCE] = 'acl';
        $response = $this->auth($options);
        $result = new PutSetDeleteResult($response);
        return $result->getData();
    }
780854
function Tokens (options) {
  if (!(this instanceof Tokens)) {
    return new Tokens(options)
  }

  var opts = options || {}

  var saltLength = opts.saltLength !== undefined
    ? opts.saltLength
    : 8

  if (typeof saltLength !== 'number' || !isFinite(saltLength) || saltLength < 1) {
    throw new TypeError('option saltLength must be finite number > 1')
  }

  var secretLength = opts.secretLength !== undefined
    ? opts.secretLength
    : 18

  if (typeof secretLength !== 'number' || !isFinite(secretLength) || secretLength < 1) {
    throw new TypeError('option secretLength must be finite number > 1')
  }

  this.saltLength = saltLength
  this.secretLength = secretLength
}
833707
def space_set_acl(args):
    
    acl_updates = [{"email": user,
                   "accessLevel": args.role} for user in args.users]
    r = fapi.update_workspace_acl(args.project, args.workspace, acl_updates)
    fapi._check_response_code(r, 200)
    errors = r.json()['usersNotFound']

    if len(errors):
        eprint("Unable to assign role for unrecognized users:")
        for user in errors:
            eprint("\t{0}".format(user['email']))
        return 1

    if fcconfig.verbosity:
        print("Successfully updated {0} role(s)".format(len(acl_updates)))

    return 0
374167
def associate_ip_address(zone_id, networks)
      params = {
          'command' => 'associateIpAddress',
          'zoneId' => zone_id
      }
      #Choose the first network from the list
      if networks.nil? || networks.empty?
        default_network = get_default_network(zone_id)
        params['networkId'] = default_network['id']
      else
        params['networkId'] = get_network(networks.first)['id']
      end
      Chef::Log.debug("associate ip params: #{params}")
      json = send_async_request(params)
      json['ipaddress']
    end
1281402
function buildSnsDestination(options) {

  let sns = {
    Resources: {},
    Parameters: {},
    Variables: {},
    Policies: []
  };

  if (options.destinations && options.destinations.sns) {
    for (let destination in options.destinations.sns) {
      sns.Parameters[destination + 'Email'] = {
        Type: 'String',
        Description:  options.destinations.sns[destination].Description
      };

      sns.Policies.push({
        PolicyName: destination + 'TopicPermissions',
        PolicyDocument: {
          Statement: [
            {
              Effect: 'Allow',
              Action: 'sns:Publish',
              Resource: cf.ref(options.name)
            }
          ]
        }
      });

      sns.Resources[destination + 'Topic'] = {
        Type: 'AWS::SNS::Topic',
        Properties: {
          TopicName: cf.join('-', [cf.stackName, destination]),
          Subscription: [
            {
              Endpoint: cf.ref(destination + 'Email'),
              Protocol: 'email'
            }
          ]
        }
      };

      sns.Variables[destination + 'Topic'] = cf.ref(destination + 'Topic');
    }
    return sns;
  }
}
1183559
function activateAssociativeDomains(xcodeProject, entitlementsFile) {
    const configurations = removeComments(
      xcodeProject.pbxXCBuildConfigurationSection()
    );
    let config;
    let buildSettings;

    for (config in configurations) {
      buildSettings = configurations[config].buildSettings;
      buildSettings.CODE_SIGN_IDENTITY = `"${CODESIGNIDENTITY}"`;
      buildSettings.CODE_SIGN_ENTITLEMENTS = `"${entitlementsFile}"`;

      // if deployment target is less then the required one - increase it
      if (buildSettings.IPHONEOS_DEPLOYMENT_TARGET) {
        const buildDeploymentTarget = buildSettings.IPHONEOS_DEPLOYMENT_TARGET.toString();
        if (compare(buildDeploymentTarget, IOS_DEPLOYMENT_TARGET) === -1) {
          buildSettings.IPHONEOS_DEPLOYMENT_TARGET = IOS_DEPLOYMENT_TARGET;
        }
      } else {
        buildSettings.IPHONEOS_DEPLOYMENT_TARGET = IOS_DEPLOYMENT_TARGET;
      }
    }
  }