Url

Struct Url 

Source
pub struct Url { /* private fields */ }
Expand description

URL fields provide support for complete or partial URLs, and supports the breaking down into scheme, domain, path, and so on.

Implementations§

Source§

impl Url

Source

pub fn get_original(&self) -> Option<&String>

Unmodified original url as seen in the event source.

Note that in network monitoring, the observed URL may be a full URL, whereas in access logs, the URL is often just represented as a path.

This field is meant to represent the URL as it was observed, complete or not.

Source

pub fn set_original(&mut self, original_arg: String)

Unmodified original url as seen in the event source.

Note that in network monitoring, the observed URL may be a full URL, whereas in access logs, the URL is often just represented as a path.

This field is meant to represent the URL as it was observed, complete or not.

§Example
Source

pub fn get_full(&self) -> Option<&String>

If full URLs are important to your use case, they should be stored in url.full, whether this field is reconstructed or present in the event source.

Source

pub fn set_full(&mut self, full_arg: String)

If full URLs are important to your use case, they should be stored in url.full, whether this field is reconstructed or present in the event source.

§Example

https://www.elastic.co:443/search?q=elasticsearch#top

Source

pub fn get_scheme(&self) -> Option<&String>

Scheme of the request, such as “https”.

Note: The : is not part of the scheme.

Source

pub fn set_scheme(&mut self, scheme_arg: String)

Scheme of the request, such as “https”.

Note: The : is not part of the scheme.

§Example

https

Source

pub fn get_domain(&self) -> Option<&String>

Domain of the url, such as “www.elastic.co”.

In some cases a URL may refer to an IP and/or port directly, without a domain name. In this case, the IP address would go to the domain field.

If the URL contains a literal IPv6 address enclosed by [ and ] (IETF RFC 2732), the [ and ] characters should also be captured in the domain field.

Source

pub fn set_domain(&mut self, domain_arg: String)

Domain of the url, such as “www.elastic.co”.

In some cases a URL may refer to an IP and/or port directly, without a domain name. In this case, the IP address would go to the domain field.

If the URL contains a literal IPv6 address enclosed by [ and ] (IETF RFC 2732), the [ and ] characters should also be captured in the domain field.

§Example

www.elastic.co

Source

pub fn get_registered_domain(&self) -> Option<&String>

The highest registered url domain, stripped of the subdomain.

For example, the registered domain for “foo.example.com” is “example.com”.

This value can be determined precisely with a list like the public suffix list (http://publicsuffix.org). Trying to approximate this by simply taking the last two labels will not work well for TLDs such as “co.uk”.

Source

pub fn set_registered_domain(&mut self, registered_domain_arg: String)

The highest registered url domain, stripped of the subdomain.

For example, the registered domain for “foo.example.com” is “example.com”.

This value can be determined precisely with a list like the public suffix list (http://publicsuffix.org). Trying to approximate this by simply taking the last two labels will not work well for TLDs such as “co.uk”.

§Example

example.com

Source

pub fn get_top_level_domain(&self) -> Option<&String>

The effective top level domain (eTLD), also known as the domain suffix, is the last part of the domain name. For example, the top level domain for example.com is “com”.

This value can be determined precisely with a list like the public suffix list (http://publicsuffix.org). Trying to approximate this by simply taking the last label will not work well for effective TLDs such as “co.uk”.

Source

pub fn set_top_level_domain(&mut self, top_level_domain_arg: String)

The effective top level domain (eTLD), also known as the domain suffix, is the last part of the domain name. For example, the top level domain for example.com is “com”.

This value can be determined precisely with a list like the public suffix list (http://publicsuffix.org). Trying to approximate this by simply taking the last label will not work well for effective TLDs such as “co.uk”.

§Example

co.uk

Source

pub fn get_subdomain(&self) -> Option<&String>

The subdomain portion of a fully qualified domain name includes all of the names except the host name under the registered_domain. In a partially qualified domain, or if the the qualification level of the full name cannot be determined, subdomain contains all of the names below the registered domain.

For example the subdomain portion of “www.east.mydomain.co.uk” is “east”. If the domain has multiple levels of subdomain, such as “sub2.sub1.example.com”, the subdomain field should contain “sub2.sub1”, with no trailing period.

Source

pub fn set_subdomain(&mut self, subdomain_arg: String)

The subdomain portion of a fully qualified domain name includes all of the names except the host name under the registered_domain. In a partially qualified domain, or if the the qualification level of the full name cannot be determined, subdomain contains all of the names below the registered domain.

For example the subdomain portion of “www.east.mydomain.co.uk” is “east”. If the domain has multiple levels of subdomain, such as “sub2.sub1.example.com”, the subdomain field should contain “sub2.sub1”, with no trailing period.

§Example

east

Source

pub fn get_port(&self) -> Option<&u64>

Port of the request, such as 443.

Source

pub fn set_port(&mut self, port_arg: u64)

Port of the request, such as 443.

§Example

443

Source

pub fn get_path(&self) -> Option<&String>

Path of the request, such as “/search”.

Source

pub fn set_path(&mut self, path_arg: String)

Path of the request, such as “/search”.

Source

pub fn get_query(&self) -> Option<&String>

The query field describes the query string of the request, such as “q=elasticsearch”.

The ? is excluded from the query string. If a URL contains no ?, there is no query field. If there is a ? but no query, the query field exists with an empty string. The exists query can be used to differentiate between the two cases.

Source

pub fn set_query(&mut self, query_arg: String)

The query field describes the query string of the request, such as “q=elasticsearch”.

The ? is excluded from the query string. If a URL contains no ?, there is no query field. If there is a ? but no query, the query field exists with an empty string. The exists query can be used to differentiate between the two cases.

Source

pub fn get_extension(&self) -> Option<&String>

The field contains the file extension from the original request url, excluding the leading dot.

The file extension is only set if it exists, as not every url has a file extension.

The leading period must not be included. For example, the value must be “png”, not “.png”.

Note that when the file name has multiple extensions (example.tar.gz), only the last one should be captured (“gz”, not “tar.gz”).

Source

pub fn set_extension(&mut self, extension_arg: String)

The field contains the file extension from the original request url, excluding the leading dot.

The file extension is only set if it exists, as not every url has a file extension.

The leading period must not be included. For example, the value must be “png”, not “.png”.

Note that when the file name has multiple extensions (example.tar.gz), only the last one should be captured (“gz”, not “tar.gz”).

§Example

png

Source

pub fn get_fragment(&self) -> Option<&String>

Portion of the url after the #, such as “top”.

The # is not part of the fragment.

Source

pub fn set_fragment(&mut self, fragment_arg: String)

Portion of the url after the #, such as “top”.

The # is not part of the fragment.

Source

pub fn get_username(&self) -> Option<&String>

Username of the request.

Source

pub fn set_username(&mut self, username_arg: String)

Username of the request.

Source

pub fn get_password(&self) -> Option<&String>

Password of the request.

Source

pub fn set_password(&mut self, password_arg: String)

Password of the request.

Trait Implementations§

Source§

impl Clone for Url

Source§

fn clone(&self) -> Url

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Url

Source§

fn default() -> Url

Returns the “default value” for a type. Read more
Source§

impl Serialize for Url

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Url

§

impl RefUnwindSafe for Url

§

impl Send for Url

§

impl Sync for Url

§

impl Unpin for Url

§

impl UnwindSafe for Url

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.