azure-core
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Azure::Core::Operation< T > Class Template Referenceabstract

Methods starting long-running operations return Operation<T> types. More...

#include <operation.hpp>

Public Member Functions

virtual ~Operation ()
 Destructs the Operation. More...
 
virtual T Value () const =0
 Final result of the long-running operation. More...
 
virtual std::string GetResumeToken () const =0
 Gets a token representing the operation that can be used to poll for the status of the long-running operation. More...
 
Azure::Core::Http::RawResponse const & GetRawResponse () const
 Gets the raw HTTP response. More...
 
OperationStatus Status () const noexcept
 Gets the current Azure::Core::OperationStatus of the long-running operation. More...
 
bool IsDone () const noexcept
 Checks if the long-running operation is completed. More...
 
bool HasValue () const noexcept
 Checks if the long-running operation completed successfully and has produced a final result. More...
 
Http::RawResponse const & Poll ()
 Gets updated status of the long-running operation. More...
 
Http::RawResponse const & Poll (Context const &context)
 Gets updated status of the long-running operation. More...
 
Response< T > PollUntilDone (std::chrono::milliseconds period)
 Periodically polls till the long-running operation completes. More...
 
Response< T > PollUntilDone (std::chrono::milliseconds period, Context &context)
 Periodically polls till the long-running operation completes;. More...
 

Protected Member Functions

 Operation ()=default
 Constructs a default instance of Operation. More...
 
 Operation (Operation &&other)
 Constructs an instance of Operation by moving in another instance. More...
 
 Operation (Operation const &other)
 Constructs an instance of Operation by copying another instance. More...
 
Operationoperator= (Operation &&other)
 Assigns an instance of Operation by moving in another instance. More...
 
Operationoperator= (Operation const &other)
 Assigns another Operation instance by copying. More...
 

Protected Attributes

std::unique_ptr< Azure::Core::Http::RawResponsem_rawResponse = nullptr
 
OperationStatus m_status = OperationStatus::NotStarted
 

Detailed Description

template<class T>
class Azure::Core::Operation< T >

Template Parameters
TThe long-running operation final result type.

Constructor & Destructor Documentation

◆ Operation() [1/3]

template<class T >
Azure::Core::Operation< T >::Operation ( )
protecteddefault

◆ Operation() [2/3]

template<class T >
Azure::Core::Operation< T >::Operation ( Operation< T > &&  other)
inlineprotected
Parameters
otherAn Operation instance to move in.

◆ Operation() [3/3]

template<class T >
Azure::Core::Operation< T >::Operation ( Operation< T > const &  other)
inlineprotected
Parameters
otherAn Operation instance to copy.

◆ ~Operation()

template<class T >
virtual Azure::Core::Operation< T >::~Operation ( )
inlinevirtual

Member Function Documentation

◆ GetRawResponse()

template<class T >
Azure::Core::Http::RawResponse const& Azure::Core::Operation< T >::GetRawResponse ( ) const
inline
Returns
A reference to an Azure::Core::Http::RawResponse.
Note
Does not give up ownership of the RawResponse.

◆ GetResumeToken()

template<class T >
virtual std::string Azure::Core::Operation< T >::GetResumeToken ( ) const
pure virtual
Returns
std::string The resume token.

◆ HasValue()

template<class T >
bool Azure::Core::Operation< T >::HasValue ( ) const
inlinenoexcept
Note
The final result is accessible from Value().
Returns
true if the long-running operation completed successfully; otherwise, false.

◆ IsDone()

template<class T >
bool Azure::Core::Operation< T >::IsDone ( ) const
inlinenoexcept
Returns
true if the long-running operation is done; otherwise, false.

◆ operator=() [1/2]

template<class T >
Operation& Azure::Core::Operation< T >::operator= ( Operation< T > &&  other)
inlineprotected
Parameters
otherAn Operation instance to move in.
Returns
A reference to this instance.

◆ operator=() [2/2]

template<class T >
Operation& Azure::Core::Operation< T >::operator= ( Operation< T > const &  other)
inlineprotected
Parameters
otherAn Operation instance to copy.
Returns
A reference to this instance.

◆ Poll() [1/2]

template<class T >
Http::RawResponse const& Azure::Core::Operation< T >::Poll ( )
inline
Returns
An HTTP Azure::Core::Http::RawResponse returned from the service.

◆ Poll() [2/2]

template<class T >
Http::RawResponse const& Azure::Core::Operation< T >::Poll ( Context const &  context)
inline
Parameters
contextA context to control the request lifetime.
Returns
An HTTP Azure::Core::Http::RawResponse returned from the service.

◆ PollUntilDone() [1/2]

template<class T >
Response<T> Azure::Core::Operation< T >::PollUntilDone ( std::chrono::milliseconds  period)
inline
Parameters
periodTime in milliseconds to wait between polls.
Returns
Response<T> the final result of the long-running operation.

◆ PollUntilDone() [2/2]

template<class T >
Response<T> Azure::Core::Operation< T >::PollUntilDone ( std::chrono::milliseconds  period,
Context context 
)
inline
Parameters
periodTime in milliseconds to wait between polls.
contextA context to control the request lifetime.
Returns
Response<T> the final result of the long-running operation.

◆ Status()

template<class T >
OperationStatus Azure::Core::Operation< T >::Status ( ) const
inlinenoexcept

◆ Value()

template<class T >
virtual T Azure::Core::Operation< T >::Value ( ) const
pure virtual
Returns
The final result of the long-running operation.

The documentation for this class was generated from the following file: