Class: Gcloud::Dns::Project
- Inherits:
-
Object
- Object
- Gcloud::Dns::Project
- Defined in:
- lib/gcloud/dns/project.rb
Overview
# Project
The project is a top level container for resources including Cloud DNS ManagedZones. Projects can be created only in the [Google Developers Console](console.developers.google.com).
See Gcloud#dns
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#additions_per_change ⇒ Object
Maximum allowed number of records to add per change.
-
#create_zone(zone_name, zone_dns, description: nil, name_server_set: nil) ⇒ Gcloud::Dns::Zone
Creates a new zone.
-
#data_per_record ⇒ Object
Maximum allowed number of data entries per record.
-
#deletions_per_change ⇒ Object
Maximum allowed number of records to delete per change.
-
#initialize(service) ⇒ Project
constructor
See Gcloud.dns.
-
#number ⇒ Object
The project number.
-
#project ⇒ Object
(also: #id)
The unique ID string for the current project.
-
#records_per_zone ⇒ Object
Maximum allowed number of records per zone in the project.
-
#reload! ⇒ Object
(also: #refresh!)
Reloads the change with updated status from the DNS service.
-
#total_data_per_change ⇒ Object
Maximum allowed total bytes size for all the data in one change.
-
#zone(zone_id) ⇒ Gcloud::Dns::Zone?
(also: #find_zone, #get_zone)
Retrieves an existing zone by name or id.
-
#zones(token: nil, max: nil) ⇒ Array<Gcloud::Dns::Zone>
(also: #find_zones)
Retrieves the list of zones belonging to the project.
-
#zones_quota ⇒ Object
Maximum allowed number of zones in the project.
Constructor Details
#initialize(service) ⇒ Project
See Gcloud.dns
55 56 57 58 |
# File 'lib/gcloud/dns/project.rb', line 55 def initialize service @service = service @gapi = nil end |
Instance Attribute Details
#gapi ⇒ Object
49 50 51 |
# File 'lib/gcloud/dns/project.rb', line 49 def gapi @gapi end |
#service ⇒ Object
45 46 47 |
# File 'lib/gcloud/dns/project.rb', line 45 def service @service end |
Class Method Details
.default_project ⇒ Object
127 128 129 130 131 132 |
# File 'lib/gcloud/dns/project.rb', line 127 def self.default_project ENV["DNS_PROJECT"] || ENV["GCLOUD_PROJECT"] || ENV["GOOGLE_CLOUD_PROJECT"] || Gcloud::GCE.project_id end |
Instance Method Details
#additions_per_change ⇒ Object
Maximum allowed number of records to add per change.
99 100 101 102 |
# File 'lib/gcloud/dns/project.rb', line 99 def additions_per_change reload! if @gapi.nil? @gapi.quota.rrset_additions_per_change if @gapi.quota end |
#create_zone(zone_name, zone_dns, description: nil, name_server_set: nil) ⇒ Gcloud::Dns::Zone
Creates a new zone.
221 222 223 224 225 226 227 228 |
# File 'lib/gcloud/dns/project.rb', line 221 def create_zone zone_name, zone_dns, description: nil, name_server_set: nil ensure_service! gapi = service.create_zone zone_name, zone_dns, description: description, name_server_set: name_server_set Zone.from_gapi gapi, service end |
#data_per_record ⇒ Object
Maximum allowed number of data entries per record.
92 93 94 95 |
# File 'lib/gcloud/dns/project.rb', line 92 def data_per_record reload! if @gapi.nil? @gapi.quota.resource_records_per_rrset if @gapi.quota end |
#deletions_per_change ⇒ Object
Maximum allowed number of records to delete per change.
106 107 108 109 |
# File 'lib/gcloud/dns/project.rb', line 106 def deletions_per_change reload! if @gapi.nil? @gapi.quota.rrset_deletions_per_change if @gapi.quota end |
#number ⇒ Object
The project number.
78 79 80 81 |
# File 'lib/gcloud/dns/project.rb', line 78 def number reload! if @gapi.nil? @gapi.number end |
#project ⇒ Object Also known as: id
The unique ID string for the current project.
71 72 73 |
# File 'lib/gcloud/dns/project.rb', line 71 def project service.project end |
#records_per_zone ⇒ Object
Maximum allowed number of records per zone in the project.
113 114 115 116 |
# File 'lib/gcloud/dns/project.rb', line 113 def records_per_zone reload! if @gapi.nil? @gapi.quota.rrsets_per_managed_zone if @gapi.quota end |
#reload! ⇒ Object Also known as: refresh!
Reloads the change with updated status from the DNS service.
232 233 234 235 |
# File 'lib/gcloud/dns/project.rb', line 232 def reload! ensure_service! @gapi = service.get_project end |
#total_data_per_change ⇒ Object
Maximum allowed total bytes size for all the data in one change.
120 121 122 123 |
# File 'lib/gcloud/dns/project.rb', line 120 def total_data_per_change reload! if @gapi.nil? @gapi.quota.total_rrdata_size_per_change if @gapi.quota end |
#zone(zone_id) ⇒ Gcloud::Dns::Zone? Also known as: find_zone, get_zone
Retrieves an existing zone by name or id.
150 151 152 153 154 155 156 |
# File 'lib/gcloud/dns/project.rb', line 150 def zone zone_id ensure_service! gapi = service.get_zone zone_id Zone.from_gapi gapi, service rescue Gcloud::NotFoundError nil end |
#zones(token: nil, max: nil) ⇒ Array<Gcloud::Dns::Zone> Also known as: find_zones
Retrieves the list of zones belonging to the project.
189 190 191 192 193 |
# File 'lib/gcloud/dns/project.rb', line 189 def zones token: nil, max: nil ensure_service! gapi = service.list_zones token: token, max: max Zone::List.from_gapi gapi, service, max end |
#zones_quota ⇒ Object
Maximum allowed number of zones in the project.
85 86 87 88 |
# File 'lib/gcloud/dns/project.rb', line 85 def zones_quota reload! if @gapi.nil? @gapi.quota.managed_zones if @gapi.quota end |