UrielCh/ovh-java-sdk

Change record's data

Closed this issue · 1 comments

Hello,

I tried to change record record's data of my domain. I use this function :
api.zone_zoneName_record_id_PUT(domain, recordID, ?);
But I don't know how to create the Object properties represents by "?" in the function?

I used this call in a part of my code:

	private int updateZone(ApiOvhDomain api, String zoneName, OvhNamedResolutionFieldTypeEnum fieldType,	String subDomain, String target) throws IOException {
		int changes = 0;
		ArrayList<Long> main = new ArrayList<>();
		try {
			main = api.zone_zoneName_record_GET(zoneName, fieldType, subDomain);
		} catch (Exception e) {
		}
		int c = 0;
		for (Long id : main) {
			c++;
			OvhRecord zone = api.zone_zoneName_record_id_GET(zoneName, id);
			if (!zone.target.endsWith(target)) {
				changes++;
				zone.target = target;
				if (c == 1)
					api.zone_zoneName_record_id_PUT(zoneName, id, zone);
				else
					api.zone_zoneName_record_id_DELETE(zoneName, id);
			}
		}
		if (main.size() == 0) {
			Long ttl = 3600L;
			api.zone_zoneName_record_POST(zoneName, fieldType, subDomain, target, ttl);
		}
		return changes;
	}