- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
  - _new_existing
  - _new
  - is_valid
  - _is_valid
  - id
  - zone
  - properties
  - field_type
  - sub_domain
  - target
  - ttl
  - delete
  - change

# NAME

Webservice::OVH::Domain::Zone::Record

# SYNOPSIS

use Webservice::OVH;

my $ovh = Webservice::OVH->new_from_json("credentials.json");

my $zone = $ovh->domain->zone("myzone.de");

my $a_record = $zone->new_record(field_type => 'A', target => '0.0.0.0', ttl => 1000 ); my $mx_record = $zone->new_record(field_type => 'MX', target => '1 my.mail.server.de.');

my $records = $zone->records(filed_type => 'A', sub_domain => 'www');

foreach my $record (@$records) {

        $record->change( target => '0.0.0.0' );
        $record->zone->refresh;
        $record->change( sub_domain => 'www', refresh => 'true' );
    }

$record->delete('true');

print "Not Valid anymore" unless $record->is_valid;

# DESCRIPTION

Provides all api Record Methods available in the api. Delete deletes the record object in the api and makes the object invalid. No actions be done with it, when it is invalid.

# METHODS

## _new_existing

Internal Method to create a Record object. This method should never be called directly.

- Parameter: $api_wrapper - ovh api wrapper object, $module - root object, $zone - parent zone Objekt, $record_id => api intern id

- Return: Webservice::OVH::Domain::Zone::Record

- Synopsis: Webservice::OVH::Domain::Zone::Record->_new_existing($ovh_api_wrapper, $module, $zone, $record_id);

## _new

Internal Method to create the zone object. This method should never be called directly.

- Parameter: $api_wrapper - ovh api wrapper object, $module - root object, $zone - parent zone, %params - key => value

- Return: Webservice::OVH::Domain::Zone::Record

- Synopsis: Webservice::OVH::Domain::Zone::Record->_new($ovh_api_wrapper, $module, $zone_name, target => '0.0.0.0', field_type => 'A', sub_domain => 'www');

## is_valid

When this record is deleted on the api side, this method returns 0.

- Return: VALUE

- Synopsis: print "Valid" if $record->is_valid;

## _is_valid

Intern method to check validity. Difference is that this method carps an error.

- Return: VALUE

- Synopsis: $record->_is_valid;

## id

Returns the api id of this record

- Return: VALUE

- Synopsis: my $id = $record->id;

## zone

Returns the zone this record is attached to.

- Return: Webservice::Domain::Zone

- Synopsis: my $zone = $record->zone;

## properties

Returns the raw properties as a hash. This is the original return value of the web-api.

- Return: HASH

- Synopsis: my $properties = $record->properties;

## field_type

Exposed property value.

- Return: VALUE

- Synopsis: my $field_type = $record->field_type;

## sub_domain

Exposed property value.

- Return: VALUE

- Synopsis: my $sub_domain = $record->sub_domain;

## target

Exposed property value.

- Return: VALUE

- Synopsis: my $target = $record->target;

## ttl

Exposed property value.

- Return: VALUE

- Synopsis: my $ttl = $record->ttl;

## delete

Deletes the record api sided and sets this object invalid. After deleting, the zone must be refreshed, if the refresh parameter is not set.

- Parameter: $refresh 'true' 'false' undef - imidiate refreshing of the domain zone

- Synopsis: $record->delete('true');

## change

Changes the record After changing the zone must be refreshed, if the refresh parameter is not set.

- Parameter: %params - key => value sub_domain target ttl refresh

- Synopsis: $record->change(sub_domain => 'www', refresh => 'true');