Creates the message used for signing SNS notifications.
        This is used to verify the bounce message when it is received.
969093
def _get_bytes_to_sign(self):
        

        # Depending on the message type the fields to add to the message
        # differ so we handle that here.
        msg_type = self._data.get('Type')
        if msg_type == 'Notification':
            fields_to_sign = [
                'Message',
                'MessageId',
                'Subject',
                'Timestamp',
                'TopicArn',
                'Type',
            ]
        elif (msg_type == 'SubscriptionConfirmation' or
              msg_type == 'UnsubscribeConfirmation'):
            fields_to_sign = [
                'Message',
                'MessageId',
                'SubscribeURL',
                'Timestamp',
                'Token',
                'TopicArn',
                'Type',
            ]
        else:
            # Unrecognized type
            logger.warning(u'Unrecognized SNS message Type: "%s"', msg_type)
            return None

        outbytes = StringIO()
        for field_name in fields_to_sign:
            field_value = smart_str(self._data.get(field_name, ''),
                                    errors="replace")
            if field_value:
                outbytes.write(text(field_name))
                outbytes.write(text("\n"))
                outbytes.write(text(field_value))
                outbytes.write(text("\n"))

        response = outbytes.getvalue()
        return bytes(response, 'utf-8')
177684
public CreateNotificationResponse createNotification(String name, String endpoint) {
        CreateNotificationRequest request = new CreateNotificationRequest();
        request.withName(name).withEndpoint(endpoint);
        return createNotification(request);
    }
998002
def new_message(self, body=''):
        
        m = self.message_class(self, body)
        m.queue = self
        return m
1184394
public static UserSystemMessage create (Name sender, String message, String bundle)
    {
        return new UserSystemMessage(sender, message, bundle, INFO);
    }
616004
protected function createMessage()
	{
		$message = new Message( new Swift_Message );

		// If a global from address has been specified we will set it on every message
		// instances so the developer does not have to repeat themselves every time
		// they create a new message. We will just go ahead and push the address.
		if ( !empty( $this->from['address'] ) )
		{
			$message->from( $this->from['address'], $this->from['name'] );
		}

		return $message;
	}
150815
function Message (opts) {
  if (!(this instanceof Message)) return new Message(opts)

  this.type = opts.type || 0
  this.clientReference = opts.clientReference || null
  this.direction = opts.direction || 'out'
  this.flashMessage = opts.flash || null
  this.messageId = opts.messageId || null
  this.networkId = opts.networkId || null
  this.rate = opts.rate || null
  this.registeredDelivery = opts.registeredDelivery || null
  this.status = opts.status || null
  this.time = opts.time || null
  this.udh = opts.udh || null
  this.units = opts.units || null
  this.updateTime = opts.updateTime || null

  if (isAnImportantParamMissing(opts)) {
    throw new SMSGHError('Important message option missing. Required options are: `from`, `to` and  `content`')
  }

  var i = 0
  var l = Message._importantParams.length
  for (i = 0; i < l; i++) {
    this[Message._importantParams[i]] = opts[Message._importantParams[i]]
  }
}
400118
def _createCheckAuthRequest(self, message):
        
        signed = message.getArg(OPENID_NS, 'signed')
        if signed:
            for k in signed.split(','):
                logging.info(k)
                val = message.getAliasedArg(k)

                # Signed value is missing
                if val is None:
                    logging.info('Missing signed field %r' % (k,))
                    return None

        check_auth_message = message.copy()
        check_auth_message.setArg(OPENID_NS, 'mode', 'check_authentication')
        return check_auth_message
1291994
def create_message(self):
        """"""
        self.counter += 1
        self._transport.send(
            "transient.transaction",
            "TXMessage #%d\n++++++++Produced@ %f"
            % (self.counter, (time.time() % 1000) * 1000),
        )
        self.log.info("Created message %d", self.counter)
698557
def create(self, message, mid=None, age=60, force=True):
        
        with self.session_lock:
            if not hasattr(message, "id"):
                message.__setattr__("id", "event-%s" % (uuid.uuid4().hex,))
            if self.session_list.get(message.id, None) is not None:
                if force is False:
                    raise SessionError("Message id: %s duplicate!" %
                                       message.id)
                else:
                    message = Message(message.to_dict(), generate_id=True)

            session = {
                "status": Status.CREATED,
                "message": message,
                "age": age,
                "mid": mid,
                "created_at": time(),
                "is_published": Event(),
                "is_resolved": Event()
            }
            self.session_list.update({
                message.id: session
            })

            return session
193622
def create_message(self, channel_id, text):
        

        baseurl = self.rest_baseurl + \
            '/channels/{}/messages'.format(channel_id)
        requests.post(baseurl,
                      headers=self.headers,
                      data=json.dumps({'content': text}))
583363
def _make_fake_message(self, user_id, page_id, payload):
        

        event = {
            'sender': {
                'id': user_id,
            },
            'recipient': {
                'id': page_id,
            },
            'postback': {
                'payload': ujson.dumps(payload),
            },
        }

        return FacebookMessage(event, self, False)
467392
def set_message(self, title, msg, typ, url=None):
        
        return self.user.send_notification(title=title,
                                           message=msg,
                                           typ=typ,
                                           url=url)
525044
def _make_signing_request(self, message):
        """"""
        message = _helpers.to_bytes(message)

        method = 'POST'
        url = _SIGN_BLOB_URI.format(self._service_account_email)
        headers = {}
        body = json.dumps({
            'bytesToSign': base64.b64encode(message).decode('utf-8'),
        })

        self._credentials.before_request(self._request, method, url, headers)
        response = self._request(
            url=url, method=method, body=body, headers=headers)

        if response.status != http_client.OK:
            raise exceptions.TransportError(
                'Error calling the IAM signBytes API: {}'.format(
                    response.data))

        return json.loads(response.data.decode('utf-8'))
1316723
private static final String createMessage(Class<? extends IckleActivity> injectorActivity,
											  Class<? extends Annotation> annotation,
											  Class<? extends Object> expectedType,
											  Class<? extends Object> valueType,
											  Field field) {
		
		StringBuilder stringBuilder = new StringBuilder();
		
		stringBuilder.append("Annotation ");
		stringBuilder.append(annotation.getName() );
		stringBuilder.append(" is illegally used on field ");
		stringBuilder.append(field.getName());
		stringBuilder.append(" of type ");
		stringBuilder.append(valueType.getName());
		stringBuilder.append(" in ");
		stringBuilder.append(injectorActivity.getName());
		stringBuilder.append(". The expected field type is ");
		stringBuilder.append(expectedType.getName());
		stringBuilder.append( ". ");
	
		return stringBuilder.toString();
	}
49832
function createActivity(activityMessage) {
  if (activityMessage === undefined ||
      activityMessage === undefined ||
      typeof activityMessage !== 'string') {
    throw new Error('Creating a new activity requires an activity message.');
  }

  var activityId = uuid++;
  var activity = {
    id: activityId,
    message: activityMessage,
    timestamps: []
  };

  activities[activityId] = activity;

  return activityId;
}
153618
static void createMessage(String textMessage, JobInstance jobInstance, DbConn cnx)
    {
        cnx.runUpdate("message_insert", jobInstance.getId(), textMessage);
    }
1118819
def sign(self, message, encoder=encoding.RawEncoder):
        
        raw_signed = libnacl.crypto_sign(message, self._signing_key)

        signature = encoder.encode(raw_signed[:libnacl.crypto_sign_BYTES])
        message = encoder.encode(raw_signed[libnacl.crypto_sign_BYTES:])
        signed = encoder.encode(raw_signed)

        return SignedMessage._from_parts(signature, message, signed)