Skip to content

Commit

Permalink
first compiling version
Browse files Browse the repository at this point in the history
  • Loading branch information
sbera87 committed Dec 3, 2024
1 parent d5f5486 commit b14a63f
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Model
* href="http://docs.aws.amazon.com/goto/WebAPI/qbusiness-2023-11-27/ChatInputStream">AWS
* API Reference</a></p>
*/
class AWS_QBUSINESS_API ChatInputStream : public Aws::Utils::Event::SmithyEventEncoderStream
class AWS_QBUSINESS_API ChatInputStream : public Aws::Utils::Event::SmithyEventEncoderStream<smithy::AwsCredentialIdentityBase>
{
public:
ChatInputStream& WriteConfigurationEvent(const ConfigurationEvent& value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ namespace Aws
class AWS_CORE_API EventEncoderStream : public Aws::IOStream
{
public:
using SIGNER_TYPE = smithy::AwsSignerBase<smithy::AwsCredentialIdentityBase>;
/**
* Creates a stream for encoding events sent by the client.
* @param bufferSize The length of the underlying buffer.
Expand All @@ -52,8 +51,6 @@ namespace Aws
*/
void SetSigner(Aws::Client::AWSAuthSigner* signer) { m_encoder.SetSigner(signer); }

void SetSigner(std::shared_ptr<SIGNER_TYPE> signer) { m_evtEncoder.SetSigner(signer); }

/**
* Allows a stream writer to communicate the end of the stream to a stream reader.
*
Expand All @@ -72,22 +69,26 @@ namespace Aws
virtual ~EventEncoderStream(){}

protected:
SmithyEventStreamEncoder m_evtEncoder;
virtual Aws::Vector<unsigned char> EncodeAndSign(const Aws::Utils::Event::Message& msg) ;
private:
Stream::ConcurrentStreamBuf m_streambuf;
EventStreamEncoder m_encoder;
};


template <typename IdentityT>
class AWS_CORE_API SmithyEventEncoderStream : public EventEncoderStream
{
public:
explicit SmithyEventEncoderStream(size_t bufferSize = DEFAULT_BUF_SIZE):EventEncoderStream(bufferSize){}
virtual ~SmithyEventEncoderStream() {}
protected:
Aws::Vector<unsigned char> EncodeAndSign(const Aws::Utils::Event::Message& msg) override ;

void SetSigner(std::shared_ptr<smithy::AwsSignerBase<IdentityT> > signer) { m_evtEncoder.SetSigner(signer); }

protected:
Aws::Vector<unsigned char> EncodeAndSign(const Aws::Utils::Event::Message& msg) override
{
return m_evtEncoder.EncodeAndSign(msg);
}
SmithyEventStreamEncoder<IdentityT> m_evtEncoder;
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,20 @@ namespace Aws
Aws::Client::AWSAuthSigner* m_signer;
};

template <typename IdentityT>
class AWS_CORE_API SmithyEventStreamEncoder : public EventStreamEncoder
{
using SIGNER_TYPE = smithy::AwsSignerBase<smithy::AwsCredentialIdentityBase>;
using SIGNER_TYPE = smithy::AwsSignerBase<IdentityT>;
public:
SmithyEventStreamEncoder(std::shared_ptr<SIGNER_TYPE> signer): EventStreamEncoder(), m_smithySigner(signer){};
SmithyEventStreamEncoder(): EventStreamEncoder(){};

void SetSigner(std::shared_ptr<SIGNER_TYPE> signer) { m_smithySigner = signer; }
protected:
bool SignEventMessage(Event::Message& msg) override;
bool SignEventMessage(Event::Message& signedMessage) override
{
return (m_smithySigner->SignEventMessage(signedMessage, m_signatureSeed));
}

private:
std::shared_ptr<SIGNER_TYPE> m_smithySigner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ namespace smithy
AWS_LOGSTREAM_ERROR(AWS_SMITHY_CLIENT_SIGNING_TAG, "Failed to adjust signing clock skew. Signer is null.");
return;
}

m_eventEncoderStreamSp->SetSigner(signer);
//typecast to streaming type
(std::dynamic_pointer_cast<Aws::Utils::Event::SmithyEventEncoderStream<IdentityT>>(m_eventEncoderStreamSp))->SetSigner(signer);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ namespace Aws
{
return m_encoder.EncodeAndSign(msg);
}


Aws::Vector<unsigned char> SmithyEventEncoderStream::EncodeAndSign(const Aws::Utils::Event::Message& msg)
{
return m_evtEncoder.EncodeAndSign(msg);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@ namespace Aws
return (m_signer->SignEventMessage(signedMessage, m_signatureSeed));
}

bool SmithyEventStreamEncoder::SignEventMessage(Event::Message& signedMessage)
{
return (m_smithySigner->SignEventMessage(signedMessage, m_signatureSeed));
}


} // namespace Event
} // namespace Utils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace Model
* $shape.documentation
*/
#end
class $typeInfo.exportValue $typeInfo.className : public Aws::Utils::Event::SmithyEventEncoderStream
class $typeInfo.exportValue $typeInfo.className : public Aws::Utils::Event::SmithyEventEncoderStream<smithy::AwsCredentialIdentityBase>
{
public:
#foreach($entry in $shape.members.entrySet())
Expand Down

0 comments on commit b14a63f

Please sign in to comment.