Share via


QueryTimeInterval Class

  • java.lang.Object
    • com.azure.monitor.query.models.QueryTimeInterval

public final class QueryTimeInterval

Class to represent a time interval. Time intervals are inclusive at the start time and exclusive at the end time.

Field Summary

Modifier and Type Field and Description
static final QueryTimeInterval ALL

Time interval of all time.

static final QueryTimeInterval LAST_12_HOURS

Time interval of the last 12 hours.

static final QueryTimeInterval LAST_1_HOUR

Time interval of the last hour.

static final QueryTimeInterval LAST_2_DAYS

Time interval of the last 2 days.

static final QueryTimeInterval LAST_30_MINUTES

Time interval of the last 30 minutes.

static final QueryTimeInterval LAST_3_DAYS

Time interval of the last 3 days.

static final QueryTimeInterval LAST_4_HOURS

Time interval of the last 4 hours.

static final QueryTimeInterval LAST_5_MINUTES

Time interval of the last 5 minutes.

static final QueryTimeInterval LAST_7_DAYS

Time interval of the last 7 days.

static final QueryTimeInterval LAST_DAY

Time interval of the last day.

Constructor Summary

Constructor Description
QueryTimeInterval(Duration duration)

Creates an instance of QueryTimeInterval using the provided duration.

QueryTimeInterval(OffsetDateTime startTime, Duration duration)

Creates an instance of QueryTimeInterval using the start and end duration of the interval.

QueryTimeInterval(OffsetDateTime startTime, OffsetDateTime endTime)

Creates an instance of QueryTimeInterval using the start and end OffsetDateTimes.

Method Summary

Modifier and Type Method and Description
boolean equals(Object o)
Duration getDuration()

Returns the duration of this QueryTimeInterval instance.

OffsetDateTime getEndTime()

Returns the end time of this QueryTimeInterval instance.

OffsetDateTime getStartTime()

Returns the start time of this QueryTimeInterval instance.

int hashCode()
static QueryTimeInterval parse(String value)

This method takes an ISO 8601 formatted time interval string and returns an instance of QueryTimeInterval.

String toString()

Methods inherited from java.lang.Object

Field Details

ALL

public static final QueryTimeInterval ALL

Time interval of all time.

LAST_12_HOURS

public static final QueryTimeInterval LAST_12_HOURS

Time interval of the last 12 hours.

LAST_1_HOUR

public static final QueryTimeInterval LAST_1_HOUR

Time interval of the last hour.

LAST_2_DAYS

public static final QueryTimeInterval LAST_2_DAYS

Time interval of the last 2 days.

LAST_30_MINUTES

public static final QueryTimeInterval LAST_30_MINUTES

Time interval of the last 30 minutes.

LAST_3_DAYS

public static final QueryTimeInterval LAST_3_DAYS

Time interval of the last 3 days.

LAST_4_HOURS

public static final QueryTimeInterval LAST_4_HOURS

Time interval of the last 4 hours.

LAST_5_MINUTES

public static final QueryTimeInterval LAST_5_MINUTES

Time interval of the last 5 minutes.

LAST_7_DAYS

public static final QueryTimeInterval LAST_7_DAYS

Time interval of the last 7 days.

LAST_DAY

public static final QueryTimeInterval LAST_DAY

Time interval of the last day.

Constructor Details

QueryTimeInterval

public QueryTimeInterval(Duration duration)

Creates an instance of QueryTimeInterval using the provided duration. The duration is the interval that starts from the provided duration and ends at the current time.

Parameters:

duration - the duration for this query time span.

QueryTimeInterval

public QueryTimeInterval(OffsetDateTime startTime, Duration duration)

Creates an instance of QueryTimeInterval using the start and end duration of the interval.

Parameters:

startTime - The start time of the interval.
duration - The end duration of the interval.

QueryTimeInterval

public QueryTimeInterval(OffsetDateTime startTime, OffsetDateTime endTime)

Creates an instance of QueryTimeInterval using the start and end OffsetDateTimes.

Parameters:

startTime - The start time of the interval.
endTime - The end time of the interval.

Method Details

equals

public boolean equals(Object o)

Overrides:

QueryTimeInterval.equals(Object o)

Parameters:

o

getDuration

public Duration getDuration()

Returns the duration of this QueryTimeInterval instance.

Returns:

the duration of this QueryTimeInterval instance.

getEndTime

public OffsetDateTime getEndTime()

Returns the end time of this QueryTimeInterval instance.

Returns:

the end time of this QueryTimeInterval instance.

getStartTime

public OffsetDateTime getStartTime()

Returns the start time of this QueryTimeInterval instance.

Returns:

the start time of this QueryTimeInterval instance.

hashCode

public int hashCode()

Overrides:

QueryTimeInterval.hashCode()

parse

public static QueryTimeInterval parse(String value)

This method takes an ISO 8601 formatted time interval string and returns an instance of QueryTimeInterval.

Parameters:

value - The ISO 8601 formatted time interval string.

Returns:

An instance of QueryTimeInterval.

toString

public String toString()

Overrides:

QueryTimeInterval.toString()

Applies to